It may seem that the story is usual. A warrior is trying to save the princess caught in the tower. But this is not a usual ordinary story. Well, this story is even not from this game.
Tower of the Sorcerer appears to be RPG-style; you have a strength (STR) and a health bar showing the health points (HP), and so do all the monsters. When you engage a monster, you and the monster take turns hitting each other until one falls, and you go first. Each attack will cause damages that make the health point of the one being attacked decreased by the strength of the attacker. A character falls if its health point drops to zero or lower after an attack.
As an excellent hacker and a player manipulating the warrior, you set your initial health point as infinity. There are $$$n$$$ monsters inside the tower. You can fight against the monsters in any order. After defeating a monster, you can set your strength to the strength of the defeated monster.
What is the minimum total amount of damages you will receive?
The first line contains two integers $$$n$$$ $$$(1 \leq n \leq 10^5)$$$ and $$$STR_w$$$ $$$(1 \leq STR_w \leq 10^5)$$$, indicating the number of monsters and the initial strength of the warrior.
In the next $$$n$$$ lines, the $$$i$$$-th line contains two integers $$$STR_i$$$ and $$$HP_i$$$ $$$(1 \leq STR_i, HP_i \leq 10^5)$$$, representing the strength and the health point of the $$$i$$$-th monster.
Output an integer in a line, representing the minimum total amount of damages the warrior will receive.
4 1 3 2 4 4 5 6 1 6
9
For the sample case: