| CodeRams Practice Problem Archive |
|---|
| Finished |
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.
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 a single integer $$$c$$$: the total number of possible lock combinations.
4 2 10 3 9 11 16 5 8
1512
3 1 2 1 3 11 12
12
| Name |
|---|


