#abc152e. [abc152_e]Flatten
[abc152_e]Flatten
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 ().
Sample Input 1
3
2 3 4
Sample Output 1
13
Let , , and , and the condition will be satisfied.
Sample Input 2
5
12 12 12 12 12
Sample Output 2
5
We can let all be .
Sample Input 3
3
1000000 999999 999998
Sample Output 3
996989508
Print the sum modulo .