#MTHA0000012. Mốc bảo dưỡng (Maintenance Milestones)
Mốc bảo dưỡng (Maintenance Milestones)
Maintenance Milestones
Version: Phuoc Hung OJ Extended
Problem Statement
A device is first serviced on day . It is then serviced every days, so service days are . Given the day interval , count the service events in the interval.
Input
One line contains four integers , , , and .
Output
Print the number of service events whose day lies in .
Subtasks
- Subtask 1 (30 points):
- .
- .
- Subtask 2 (70 points):
- .
- .
Examples
Example 1
Input
3 7 10 30
Output
3
Explanation
The milestones are . The interval contains , so the answer is .
Example 2
Input
5 10 5 5
Output
1
Explanation
Day is the first service day and lies in the interval, so the answer is .
Example 3
Input
100 25 101 199
Output
3
Explanation
After day , the milestones are ; the interval contains , for a total of .