문제
Bessie is a hungry cow. Each day, for dinner, if there is a haybale in the barn, she will eat one haybale. Farmer John does not want Bessie to starve, so some days he sends a delivery of haybales, which arrive in the morning (before dinner). In particular, on day , Farmer John sends a delivery of haybales (, ).
Compute the total number of haybales Bessie will eat during the first days.
입력
The first line contains and (, ).
The next lines each contain and . It is additionally guaranteed that .
출력
Output the number of haybales that Bessie will eat during the first days.
Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).
예제 입력 1
1 5
1 2
예제 출력 1
2
예제 입력 2
2 5
1 2
5 10
예제 출력 2
3
예제 입력 3
2 5
1 10
5 10
예제 출력 3
5
점수
Inputs 4-7: Inputs 8-13: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인