atcoder#ARC120A. [ARC120A] Max Add
[ARC120A] Max Add
Score : points
Problem Statement
For a sequence , let be the sum of its elements after the following is done:
- For each , in this order, do the following operation: add the current maximum value of an element in to .
You are given a sequence of length : . For each integer between and (inclusive), find when .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain when .
3
1 2 3
2
8
19
For example, when , is computed as follows:
- First, for , add to the current maximum value of , which is , making .
- Next, for , add to the current maximum value of , which is , making .
- Finally, for , add to the current maximum value of , which is , making .
- is the sum of the elements of now, which is .