#abc185b. [abc185_b]Smartphone Addiction
[abc185_b]Smartphone Addiction
Problem Statement
The battery of Takahashi's smartphone has mAh capacity. At time , , , and so on (that is, at time for every integer ), the battery charge decreases by mAh.
Takahashi will leave his house with his phone fully charged at time , visit a cafe times, and return home at time .
He will stay at the -th cafe from time to time . During this stay, he charges his phone, so the battery charge does not decrease. Instead, at time for every integer , it increases by . However, if it is already equal to the battery capacity, it does not increase nor decrease.
Determine whether he can return home without the battery charge dropping to on the way.
Constraints
- $0 \\lt A_1 \\lt B_1 \\lt A_2 \\lt B_2 \\lt A_3 \\lt B_3 \\lt \\dots \\lt A_M \\lt B_M \\lt T$
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If Takahashi can return home without the battery charge dropping to on the way, print Yes
; otherwise, print No
.
Sample Input 1
10 2 20
9 11
13 17
Sample Output 1
Yes
The battery charge changes as follows:
- Time (leaving home): mAh
- Time (the beginning of the stay at the first cafe): mAh
- Time (the end of the stay at the first cafe): mAh (He charges his phone in a cafe.)
- Time (the beginning of the stay at the second cafe): mAh
- Time (the end of the stay at the second cafe): mAh
- Time (getting home): mAh
During this process, the battery charge never drops to , so we print Yes
.
Sample Input 2
10 2 20
9 11
13 16
Sample Output 2
No
This case is the same as Sample Input/Output 1 until he starts his stay at the second cafe with mAh charge.
When he ends his stay there at time , the battery charge is mAh.
Then at time , it drops to , so we print No
.
Sample Input 3
15 3 30
5 8
15 17
24 27
Sample Output 3
Yes
The battery charge drops to mAh when he gets home, but it never drops to on the way.
Sample Input 4
20 1 30
20 29
Sample Output 4
No
The battery charge drops to at time .
Sample Input 5
20 1 30
1 10
Sample Output 5
No
Note that when the battery charge is equal to the battery capacity, staying at a cafe does not increase the battery charge.