题目描述
Given are N positive integers A1,...,AN.
Consider positive integers B1,...,BN that satisfy the following condition.
Condition: For any i,j such that 1≤i<j≤N, AiBi=AjBj holds.
Find the minimum possible value of B1+...+BN for such B1,...,BN.
Since the answer can be enormous, print the sum mod (109+7).
已知有 N 个正整数 A1,...,AN 。
考虑满足以下条件的正整数 B1,...,BN .
条件:对于任意 i,j , 1≤i<j≤N , AiBi=AjBj 成立。
求这样的 B1,...,BN 的 B1+...+BN 的最小可能值。
由于答案可能很大,请打印模乘和 ( 109+7 )。
输入格式
输入内容按以下格式标准输入:
N
A1 ... AN
输出格式
打印满足条件的 B1,...,BN 中 B1+...+BN 的最小值,模数为 ( 109+7 )。
样例 #1
样例输入 #1
3
2 3 4
样例输出 #1
13
样例 #2
样例输入 #2
5
12 12 12 12 12
样例输出 #2
5
样例 #3
样例输入 #3
3
1000000 999999 999998
样例输出 #3
996989508
说明
数据规模与约定
- 1≤N≤104
- 1≤Ai≤106
- 所有输入值均为整数。
样例 1 解释
让 B1=6 、 B2=4 和 B3=3 ,即可满足条件。
样例 2 解释
我们可以让所有 Bi 都成为 1 。
样例 3 解释
打印取模 (109+7) 的和。