Farmer John is running out of supplies and needs to purchase pounds of hay for his cows.
He knows hay suppliers conveniently numbered . Supplier i sells packages that contain pounds of hay at a cost of dollars. Each supplier has an unlimited number of packages available, and the packages must be bought whole.
Help FJ by finding the minimum cost necessary to purchase at least pounds of hay.
输入格式
* Line : Two space-separated integers: and
* Lines : Line contains two space-separated integers: and
输出格式
* Line : A single integer representing the minimum cost FJ needs to pay to obtain at least pounds of hay.
样例
样例输入 1
2 15
3 2
5 3
样例输出 1
9
数据范围与提示
FJ can buy three packages from the second supplier for a total cost of .