Problem B: 黄金矿工

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:2 Solved:2

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