logo AlgoBeat OnlineJudge
登录 注册

#201978. [USACO08NOV] Buying Hay S

内存限制:125 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 .