Problem1200--黄金矿工

1200: 黄金矿工

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 3  Solved: 3
[Submit] [Status] [Web Board] [Creator:]

Description

Input

3 10 

1 1 1 1 

2 2 2 2 

1 3 15 9

Output

3


HINT

-----sample2------

1 1 13 1
2 2 2 2
1 3 4 7

-----sample2-----

7

-----------

30%的数据,0 < T ≤ 4000 


100%的数据,N ≤ 200, 0 < T ≤ 40000 

Source/Category