* Line 1: Two space-separated integers: N and L. * Lines 2..1+N: Line i+1 contains two space-separated integers: H(i) and W(i). (1 <= H(i) <= 1,000,000; 1 <= W(i) <= L).
* Line 1: Two space-separated integers: N and L. * Lines 2..1+N: Line i+1 contains two space-separated integers: H(i) and W(i). (1 <= H(i) <= 1,000,000; 1 <= W(i) <= L).
* Line 1: The minimum possible total height for the set of bookshelves. SAMPLE
5 10 //五本书,每个书架的宽度不超过10
5 7 //第一本书的高度及宽度
9 2
8 5
13 2
3 8
INPUT DETAILS: There are 5 books. Each shelf can have total width at most 10.
OUTPUT FORMAT:
21 //5+13+3=21
OUTPUT DETAILS: There are 3 shelves, the first containing just book 1 (height 5, width 7), the second containing books 2..4 (height 13, width 9), and the third containing book 5 (height 3, width 8).