403065: GYM100989 C 1D Cafeteria (A)
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
C. 1D Cafeteria (A)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
After a long ACM training day, Master Hasan invited his trainees for a light dinner in the cafeteria. The cafeteria has N tables, each with a number of chairs around it. Before accepting the trainees into the cafeteria, Master Hasan wants to know how many unused chairs are there in the cafeteria. If there isn't enough chairs, he might invite them to a well-known Indian restaurant.
InputThe first line of input contains a single integer N (1 ≤ N ≤ 100), the number of tables in the cafeteria.
Each of the following N lines contains two integers describing a table, A and B (1 ≤ A ≤ B ≤ 100), where A represents the number of used chairs, and B represents the total number of chairs around that table.
OutputPrint the number of unused chairs in the cafeteria.
ExampleInput3Output
1 3
4 4
5 8
5