33OJ
登录 注册

#P2918. [USACO08NOV] Buying Hay S

[USACO08NOV] Buying Hay S

Problem Description

Farmer John is running out of supplies and needs to purchase H(1≤H≤50,000)H(1 \le H \le 50,000) pounds of hay for his cows.

He knows N(1≤N≤100)N(1 \le N \le 100) hay suppliers conveniently numbered 1..N1..N. Supplier i sells packages that contain Pi(1≤Pi≤5,000)P_i(1 \le P_i \le 5,000) pounds of hay at a cost of Ci(1≤Ci≤5,000)C_i(1 \le C_i \le 5,000) 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 HH pounds of hay.

Input Format

* Line 11: Two space-separated integers: NN and HH

* Lines 2..N+12..N+1: Line i+1i+1 contains two space-separated integers: PiP_i and CiC_i

Output Format

* Line 11: A single integer representing the minimum cost FJ needs to pay to obtain at least HH pounds of hay.

2 15 
3 2 
5 3 

9 

Hint

FJ can buy three packages from the second supplier for a total cost of 99.