032. Prison Break
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Unfortunately, you have been sent to prison because you solved too many problems at CodeQuest 2021. Now, you're trying to break out. Your cell has a combination lock with $$$n$$$ dials. You're planning to try all of the possible combinations of the lock, and you want to know how many possible combinations the lock has.

Input

The first line of input contains a positive integer $$$n$$$: the number of dials on the lock. The next $$$n$$$ lines each contain two space-separated integers: the lower and upper limits of each lock dial. For example, if the lower and upper limits were $$$3$$$ and $$$7$$$, respectively, then the lock dial could turn to 3, 4, 5, 6, or 7.

Output

Output a single integer $$$c$$$: the total number of possible lock combinations.

Examples
Input
4
2 10
3 9
11 16
5 8
Output
1512
Input
3
1 2
1 3
11 12
Output
12