Codeforces Round 428 (Div. 2)
D
Winter is here
Codeforces
2200
原题
← CE →
翻译中…

Winter is here at the North and the White Walkers are close. John Snow has an army consisting of $*n*$ soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the White Walkers.

翻译中…

He has created a method to know how strong his army is. Let the $*i*$-th soldier’s strength be $*a*_{*i*}$. For some $*k*$ he calls $*i*_{1}, *i*_{2}, ..., *i*_{*k*}$ a clan if $*i*_{1} < *i*_{2} < *i*_{3} < ... < *i*_{*k*}$ and $*gcd*(*a*_{*i*_{1}}, *a*_{*i*_{2}}, ..., *a*_{*i*_{*k*}}) > 1$ . He calls the strength of that clan $*k*·*gcd*(*a*_{*i*_{1}}, *a*_{*i*_{2}}, ..., *a*_{*i*_{*k*}})$. Then he defines the strength of his army by the sum of strengths of all possible clans.

翻译中…

Your task is to find the strength of his army. As the number may be very large, you have to print it modulo $1000000007$ ($10^{9} + 7$).

翻译中…

Greatest common divisor (gcd) of a sequence of integers is the maximum possible integer so that each element of the sequence is divisible by it.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 200000$) — the size of the army.

翻译中…

The second line contains $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($1 ≤ *a*_{*i*} ≤ 1000000$) — denoting the strengths of his soldiers.

翻译中…

Output

翻译中…

Print one integer — the strength of John Snow's army modulo $1000000007$ ($10^{9} + 7$).

翻译中…

Note

翻译中…

In the first sample the clans are ${1}, {2}, {1, 2}$ so the answer will be $1·3 + 1·3 + 2·3 = 12$

翻译中…

样例

Input #1
3
3 3 1
Output #1
12
InputCopy OutputCopy
Input #2
4
2 3 4 6
Output #2
39
InputCopy OutputCopy
题目信息
题号
839D
时间限制
3 s
内存限制
256 MB
标签
组合数学
动态规划
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。