atcoder#RELAYH. 早起き
早起き
Score : points
Problem Statement
Takahashi recorded his daily life for the last few days as a integer sequence of length , as follows:
This means that, starting from a certain time , he was:
- sleeping for exactly seconds
- then awake for exactly seconds
- then sleeping for exactly seconds
- :
- then sleeping for exactly seconds
- then awake for exactly seconds
In this record, he waked up times.
Takahashi is wondering how many times he waked up early during the recorded period.
Here, he is said to wake up early if he wakes up between AM and AM, inclusive.
If he wakes up more than once during this period, each of these awakenings is counted as waking up early.
Unfortunately, he forgot the time .
Find the maximum possible number of times he waked up early during the recorded period.
For your information, a day consists of seconds, and the length of the period between AM and AM is seconds.
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
:
Output
Print the maximum possible number of times he waked up early during the recorded period.
3
28800 57600
28800 57600
57600 28800
2
10
28800 57600
4800 9600
6000 1200
600 600
300 600
5400 600
6000 5760
6760 2880
6000 12000
9000 600
5