#RELAYH. 早起き

早起き

Score : 100100 points

Problem Statement

Takahashi recorded his daily life for the last few days as a integer sequence of length 2N2N, as follows:

  • a1,b1,a2,b2,...,aN,bNa_1, b_1, a_2, b_2, ... , a_N, b_N

This means that, starting from a certain time TT, he was:

  • sleeping for exactly a1a_1 seconds
  • then awake for exactly b1b_1 seconds
  • then sleeping for exactly a2a_2 seconds
  • :
  • then sleeping for exactly aNa_N seconds
  • then awake for exactly bNb_N seconds

In this record, he waked up NN 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 4:004:00 AM and 7:007:00 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 TT.

Find the maximum possible number of times he waked up early during the recorded period.

For your information, a day consists of 8640086400 seconds, and the length of the period between 4:004:00 AM and 7:007:00 AM is 1080010800 seconds.

Constraints

  • 1N1051 \leq N \leq 10^5
  • 1ai,bi1051 \leq a_i, b_i \leq 10^5
  • aia_i and bib_i are integers.

Input

The input is given from Standard Input in the following format:

NN

a1a_1 b1b_1

a2a_2 b2b_2

:

aNa_N bNb_N

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