[USACO 2008 Nov S]Buying Hay
题号:NC24979
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

Farmer John is running out of supplies and needs to purchase H (1 <= H <= 50,000) pounds of hay for his cows.
He knows N (1 <= N <= 100) hay suppliers conveniently numbered 1..N. Supplier i sells packages that contain Pi (1 <= Pi <= 5,000) pounds of hay at a cost of Ci (1 <= Ci <= 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 H pounds of hay.

输入描述:

* Line 1: Two space-separated integers: N and H
* Lines 2..N+1: Line i+1 contains two space-separated integers: Pi and Ci

输出描述:

* Line 1: A single integer representing the minimum cost FJ needs to pay to obtain at least H pounds of hay.
示例1

输入

复制
2 15 
3 2 
5 3 

输出

复制
9

说明

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