시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 0 0 0 0.000%

문제

The musical band Be Geeks! got its name by no accident, as all the members are genuine math geeks. Among others, they love examining various properties of number sequences. Let’s see an example of their subject of interest.

• Let A be a nonempty sequence of positive integers, A = (a1, a2, ..., aN).
• Let G(i, j) = gcd(ai, ai+1, . . . , aj), where 1 ≤ i ≤ j ≤ N.
• Let M(i, j) = max(ai, ai+1, . . . , aj), where 1 ≤ i ≤ j ≤ N.
• Let P(i, j) = G(i, j) · M(i, j), where 1 ≤ i ≤ j ≤ N.
• Let F(A) = ΣP(i, j) over all pairs of integers 1 ≤ i ≤ j ≤ N.

The function gcd stands for the greatest common divisor of the given values. The greatest common divisor of a nonempty sequence of integers is the biggest integer which divides each integer in the sequence evenly.

입력

The first line contains one integer N (1 ≤ N ≤ 2 · 105). The next line contains N integers a1, a2, . . . , aN (1 ≤ ai ≤ 109).

출력

Print the value of F(A) modulo 1 000 000 007.

예제 입력 1

4
1 2 3 4


예제 출력 1

50


예제 입력 2

5
2 4 6 12 3


예제 출력 2

457