#D2405. Movie

    ID: 1998 Type: Default 1000ms 267MiB

Movie

Movie

Problem

Taro decided to watch one movie every day at a nearby movie theater during the summer vacation. (Taro has 31 days of summer vacation from August 1st to August 31st.)

The theater is set to show n movies during the summer vacation. Each movie is assigned a number from 1 to n, and the i-th movie will only be shown between August ai and August bi.

When Taro sees a movie, he gets 100 happiness if it's the first movie he sees. But if you've seen a movie even once in the past, you'll get 50 happiness.

Taro decided to make a plan for the summer vacation based on the schedule of the movie to be screened. Find the total value when watching the movie so that the total value of happiness that Taro can get is maximized.

It is guaranteed that one or more movies will be shown each day.

Constraints

  • 1 ≤ n ≤ 100
  • 1 ≤ ai ≤ bi ≤ 31 (1 ≤ i ≤ n)

Input

The input is given in the following format.

n a1 b1 a2 b2 ... an bn

The first line is given one integer n. Of the n lines from the second line, the i line is given two integers ai and bi, separated by blanks.

Output

Output the maximum value of the total happiness that Taro can obtain.

Examples

Input

4 1 31 2 2 2 3 3 3

Output

1700

Input

5 1 10 10 20 20 21 22 31 4 20

Output

1800

inputFormat

Input

The input is given in the following format.

n a1 b1 a2 b2 ... an bn

The first line is given one integer n. Of the n lines from the second line, the i line is given two integers ai and bi, separated by blanks.

outputFormat

Output

Output the maximum value of the total happiness that Taro can obtain.

Examples

Input

4 1 31 2 2 2 3 3 3

Output

1700

Input

5 1 10 10 20 20 21 22 31 4 20

Output

1800

样例

4
1 31
2 2
2 3
3 3
1700