Slay the Spire 2 is a world-renowned game. In this game, you play as a character climbing a high tower, using cards to defeat monsters along the way until victory is achieved.
Now you must face a powerful enemy. Unfortunately, your remaining health cannot withstand even a single unblocked attack. Fortunately, you know the cards you will draw and the monster's actions for the next $n$ turns. You want to quickly determine whether you can defeat the monster within $n$ turns without dying.
The cards in the game are divided into two types:
- Strike: Playing this card deals $S$ points of damage.
- Defend: Playing this card provides $D$ points of block.
The condition to defeat the enemy is that the total damage you deal is greater than or equal to the monster's health $HP$.
In the $i$-th turn, the player's actions are defined as:
- Discard the cards currently in hand and clear any remaining block from the previous turn (if any).
- Draw $a_i$ Strike cards and $5 - a_i$ Defend cards.
- Choose and play no more than $3$ cards; each card can only be played once.
- End the action.
In the $i$-th turn, the monster's action is defined as:
- Deal $k_i$ points of damage to the player. If $k_i$ is greater than the player's current block value, you will die, and the game ends immediately.
- End the action.
In each turn, the order of actions for both parties is:
- Player's turn.
- If the monster dies, the player wins, and the game ends.
- Monster's turn.
- If the player dies, the game ends.
You need to determine if you can defeat the monster within $n$ turns. If you can, output Yes and the earliest turn in which the monster can be defeated; if you cannot defeat the monster within $n$ turns or if the player dies during the process, output No.
Input
The first line contains an integer $n$ ($1 \le n \le 100$), representing the predicted number of game turns.
The second line contains three positive integers $S, D, HP$ ($1 \le S, D \le 10$, $1 \le HP \le 100$), representing the damage dealt by a Strike, the block provided by a Defend, and the monster's health, respectively.
The next $n$ lines each contain two non-negative integers $a_i, k_i$ ($0 \le a_i \le 5$, $0 \le k_i \le 50$), describing the card draw situation for the $i$-th turn (drawing $a_i$ Strikes) and the monster's attack damage.
Output
If the monster can be defeated within $n$ turns, output Yes on one line, and output an integer on the next line representing the earliest turn in which the monster is defeated.
If the monster cannot be defeated within $n$ turns or if the player dies, output No.
Examples
Input 1
4 5 5 25 4 0 1 10 2 12 2 12
Output 1
Yes 3
Input 2
5 1 5 4 1 4 2 0 5 3 0 4 0 1
Output 2
Yes 3
Input 3
4 1 5 5 0 1 3 3 0 5 2 1
Output 3
No
Input 4
5 1 4 4 5 4 1 5 3 1 4 4 5 4
Output 4
No
Input 5
4 4 5 4 1 2 1 0 4 5 1 1
Output 5
Yes 1
Note
For the 1st sample case, the optimal card-playing strategy is as follows:
- Turn 1: The player draws 4 Strikes and 1 Defend. The monster's attack power is 0. The player plays 3 Strikes, dealing 15 points of damage. At the end of the turn, the monster has 15 health remaining. The player receives 0 damage and survives.
- Turn 2: The player draws 1 Strike and 4 Defends. The monster's attack power is 10. To survive, the player must play 2 Defends to gain 10 block, leaving 1 remaining card-play action to play 1 Strike, dealing 5 points of damage. At the end of the turn, the monster has 10 health remaining. The player receives a 10-point attack, which is negated by the block, and survives.
- Turn 3: The player draws 2 Strikes and 3 Defends. Since the monster will not perform its attack phase if it dies, the player can directly play 2 Strikes, dealing 10 points of damage. At this point, the cumulative damage reaches 30, the monster dies, and the game ends in the 3rd turn.