~/algor $ cat contests/round-6/G
G. Painting the road
Problem G
ICPC rules
1000 ms
128 MB
A road is divided into cells numbered from to . painters worked: painter painted one coat on every cell from cell to cell (both included). How many cells have at least coats?
Input
The first line contains three positive integers: , and . Line of the next lines contains two positive integers: and .
Output
One integer — the number of cells.
Note
Examples
Input #1
10 4 2 1 4 3 7 6 9 2 3
Output #1
5
Input #2
5 2 2 1 2 4 5
Output #2
0