Hyein starts his day by drinking coffee in the morning.
He has N kinds of coffee. Kind i has ci cups left, and it expires on day ti counting from today. Every cup of kind i (1≤i≤N) that he drinks gives him satisfaction si. He cannot drink coffee after its expiry date, but he can still drink it on day ti itself. For example, if ti=1, he either drinks that coffee today or gives it up.
Hyein drinks only one cup a day, and only in the morning. On a day when no drinkable coffee is left, he gains no satisfaction.
Find the maximum total satisfaction he can gain from today through day K.