Kokoa starts every morning with a cup of coffee.
Her cupboard holds N kinds of coffee. Kind i has ci cups left, and counting today as day 1, it can be drunk up to day ti. Coffee past its date cannot be drunk, but day ti itself is still fine. If ti=1, that coffee has to be drunk today or thrown away.
One cup of kind i gives satisfaction si. Kokoa drinks one cup a day and only in the morning. On a day with no coffee left she gains no satisfaction. Find the largest total satisfaction she can collect from day 1 through day K.