Bookcase Solidity United

아직 제출이 없습니다시간 제한5초메모리 제한512 MB

문제

You work in Bookcase Solidity United (BSU), a company that tests furniture under various load and measures its reliability. Right now, they are testing a bookcase with nn shelves, placed from top to bottom.

The bookcase will be tested by putting heavy iridium balls on some of the shelves and observing them break. We assume that all balls are the same and BSU has infinitely many of them.

The engineers measured that the ii-th shelf from the top can endure strictly less than a_ia\_i balls. If there are xa_ix \ge a\_i balls on the shelf, it breaks and the balls fall. If there are no unbroken shelves, all the balls fall on the floor. Otherwise, x2\left\lfloor \frac x 2 \right\rfloor balls fall on the nearest unbroken shelf jj below, and the rest of the balls fall on the floor. (Don't worry, the floor is solid enough to hold all the balls.) If, after this operation, the number of balls on the jj-th shelf is not less than a_ja\_j, then the jj-th shelf breaks, the balls fall from the shelf in the same way as described above, and so on. The process terminates either when all the balls are on the floor or the next shelf is solid enough to hold the balls which fell on it.

To measure the reliability, the employees of BSU put the balls one by one on some of the shelves. The goal is to break kk upmost shelves using the minimum possible number of balls. As trying various placement variants is costly, time-consuming, and produces much noise from heavy falling balls, the management of the company has ordered you to calculate the least number of balls to break kk upmost shelves, for each kk from 11 to nn.

입력

The first line contains an integer nn, the number of shelves in the bookcase (1n701 \le n \le 70).

The second line contains nn integers a_ia\_i, where a_ia\_i is the minimal number of balls that break the ii-th shelf (1a_i1501 \le a\_i \le 150). The shelves are numbered from top to bottom.

출력

Print nn integers. The kk-th integer equals the minimal number of balls needed to break kk upmost shelves.

힌트

In the first example, we can place eight balls one by one on the first shelf. The shelf will surely break, and 82=4\left\lfloor \frac 82\right\rfloor = 4 balls will fall on the second shelf. The second shelf now holds 4>14 > 1 balls, so it breaks and 42=2\left\lfloor \frac 42\right\rfloor = 2 balls fall to the third shelf. The third shelf also breaks, and all the balls fall onto the floor. Thus, the answer is 88.

In the second example, to break all the shelves, we can put 22 balls on the third shelf, then we put 33 balls on the second shelf, after that we put 1010 balls on the first shelf, and, finally, we put 22 balls on the fourth shelf. So, we put 2+3+10+2=172 + 3 + 10 + 2 = 17 balls.