Numerical Intervals
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 z such that x < z < y.
Semi-open Intervals: Denoted as [x, y) and (x, y], they include all numbers z such that x ≤ z < y and x < z ≤ y, respectively.
Closed Interval: Denoted as [x, y], it includes all numbers z such that x ≤ z ≤ y.
For homework, Vasya needs to count the number of integers within each given interval. Since they haven't covered real numbers yet, x and y are expressed as rational numbers: x = a/b, y = c/d (a and c are integers, b and d are positive integers).
Consider the example: [3/2, 4). Here, d = 1, so instead of 4/1, it is simply written as 4. This interval contains two integers: 2 and 3, while the number 4 is not included.
Help Vasya with his homework by writing a program that calculates the number of integers within a given numerical interval.
Input
The input starts with an opening square or round bracket. Next is the number x in the format a/b or a, where |a| ≤ 10^9, 0 < b ≤ 10^9. This is followed by a comma and a space. Then, the number y 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).
Output
For the given numerical interval, output a single number—the count of integers within it.