#SDNU1310. Cover Interval

Cover Interval

Description

On the math class, Teacher Young want to know some of students’ ability of programming, so he write a simple problem on the blackboard:

“There are several integer intervals [a , b] on the x-axis, and a is smaller than b, please compute the total length covered by these intervals.

Format

Input

The input has multiple test cases. Each case begins with a line contains one integer N(1N100000)N(1\le N\le 100000), which is the number of the intervals. Then comes NN lines, each line has two integers, AA and BB(separated by a space,0A<B10000000000\le A\lt B\le 1000000000), which are the left edge and right edge of the interval.

Output

For each test cases, output one Integer representing the total length.

Samples

3
2 5
1 4
7 8
5