atcoder#RELAY2H. Akashic Records
Akashic Records
Score : points
Problem Statement
Consider an infinite sequence Initially, the values of all the terms are , and from this state we will sequentially perform operations. The -th operation is as follows:
- For every positive integer , add to the value of .
Find the value of the largest term after these operations.
Constraints
- All are distinct.
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the value of the largest term after the operations.
3
2 10
3 -20
6 15
10
The values of each terms in the sequence change as follows:
- Before the operations:
- After the -st operation:
- After the -nd operation:
- After the -rd operation:
The value of the largest term after all the operations is .
3
10 -3
50 4
100 -5
1
5
56 114834
72 -149861
100 190757
192 -132693
240 133108
438699