Pick and order problems within T minutes, each solved back to back, to maximize the sum of M_i - (start minute) * P_i.
The SW skill test runs for TTT minutes and has NNN problems. You may submit source code at any moment while the test is running.
Solving problem iii at minute ttt earns Mi−t×PiM_i - t \times P_iMi−t×Pi points. Solving problem iii takes the contestant RiR_iRi minutes.
The contestant works on one problem at a time and never pauses a problem once started. The contestant freely chooses which problems to solve and in what order, and may skip any problem. If the test starts at minute 0, the solved problems run back to back, and the moment the last one is solved cannot exceed minute TTT.
The final score is the sum of the points of the solved problems, and it is 0 when no problem is solved. Write a program that finds the largest score the contestant can get.
The first line contains NNN and TTT. (1≤N≤501 \le N \le 501≤N≤50, 1≤T≤100 0001 \le T \le 100\,0001≤T≤100000)
The second line contains M1,M2,…,MNM_1, M_2, \ldots, M_NM1,M2,…,MN, the third line contains P1,P2,…,PNP_1, P_2, \ldots, P_NP1,P2,…,PN, and the fourth line contains R1,R2,…,RNR_1, R_2, \ldots, R_NR1,R2,…,RN, each separated by spaces. (1≤Mi,Pi,Ri≤100 0001 \le M_i, P_i, R_i \le 100\,0001≤Mi,Pi,Ri≤100000)
Print the largest score the contestant can get on the first line.