Seolgwak is in charge of streaming a large conference. The conference has sessions, and session is held during the time interval .
Seolgwak can use two streaming channels A and B. Channel A may stream for at most time units, and channel B may stream for at most time units. The streaming interval of channel A is chosen as , where are nonnegative integer times, , and . Channel B is chosen in the same way as , with and .
The two channels cannot be operated at the same time. Formally, either or must hold. If one interval ends exactly when the other starts, this is not considered simultaneous operation.
A session is fully streamed if is completely contained in the streaming interval of channel A or channel B.
Choose the two streaming intervals to maximize the number of fully streamed sessions.
Input
The input is given in the following format.
Output
Print the maximum possible number of fully streamed sessions.
Constraints
- .
- .
- ().