atcoder#ABC152E. [ABC152E] Flatten
[ABC152E] Flatten
Score : points
Problem Statement
Given are positive integers .
Consider positive integers that satisfy the following condition.
Condition: For any such that , holds.
Find the minimum possible value of for such .
Since the answer can be enormous, print the sum modulo ().
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum possible value of for that satisfy the condition, modulo ().
3
2 3 4
13
Let , , and , and the condition will be satisfied.
5
12 12 12 12 12
5
We can let all be .
3
1000000 999999 999998
996989508
Print the sum modulo .