#GD0000011. Rồng (Dragons)
Rồng (Dragons)
Dragons
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A player starts with strength and must defeat dragons. Dragon has strength and reward . The player wins a duel only if the current strength is strictly greater than ; after winning, strength increases by . Dragons may be fought in any order. Determine whether all dragons can be defeated.
Input
The first line contains . Each of the next lines contains .
Output
Print YES if all dragons can be defeated, otherwise print NO.
Subtasks
General constraints:
-
.
-
.
-
.
-
.
-
Subtask 1 (20 points): ,
-
Subtask 2 (30 points):
-
Subtask 3 (50 points): No additional constraints.
Examples
Input
2 2
1 99
100 0
Output
YES
Explanation
Strength , so the first dragon is defeated and strength becomes . Then , so the second dragon is also defeated.