Today at school, Vasya learned about numerical intervals. Each interval is defined by a pair of numbers—its start and end—and specifies whether each endpoint is included. There are four types of intervals:
Open interval. Denoted as (x, y), it includes all numbers such that x < z < y.
Semi-open intervals. Denoted as [x, y) and (x, y], they include all numbers such that x \leq z < y and x < z \leq y, respectively.
Closed interval. Denoted as [x, y], it includes all numbers such that x \leq z \leq y.
For homework, Vasya needs to count the number of integers within each given interval. Since they haven't covered real numbers yet, and are expressed as rational numbers: x = a/b, y = c/d ( and are integers, and are positive integers).
Consider the example: [3/2, 4). Here, d = 1, so instead of , it is simply written as . This interval contains two integers: and ; the number is not included.
Help Vasya with his homework by writing a program that calculates the number of integers within a given numerical interval.
The input starts with an opening square or round bracket. Next is the number in the format or , where |a| \leq 10^9, 0 < b \leq 10^9. This is followed by a comma and a space. Then, the number in the same format. Finally, a closing square or round bracket. The input ends with a newline.
It is guaranteed that the given numerical interval is not empty (i.e., it contains at least one number, not necessarily an integer).
For the given numerical interval, output a single number: the count of integers within it.
Example 1