Watering the Plants
문제
Bessie's garden has plants labeled through () from left to right. Bessie knows that plant requires at least () units of water.
Bessie has a very peculiar irrigation system with canals, numbered through . Each canal has an associated unit cost (), such that Bessie can pay to provide plants and each with units of water, where is a non-negative integer.
Bessie is busy and may not have time to use all the canals. For each compute the minimum cost required to water plants through using only the first canals.
입력
The first line contains a single positive integer .
The second line contains space-separated integers .
The third line contains space-separated integers .
출력
Output newline-separated integers. The th integer should contain the minimum cost to water the first plants using the first canals.
예제
예제 1
3 39 69 33 30 29
2070 2127
예제 2
3 33 82 36 19 1
1558 676
예제 3
8 35 89 44 1 35 3 62 50 7 86 94 62 63 9 49
623 4099 4114 6269 6272 6827 8827