Codeforces Round 428 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

combinatorics

dp

math

number theory

*2200

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Winter is here

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputWinter 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*_{i1}, *a*_{i2}, ..., *a*_{ik}) > 1 . He calls the strength of that clan *k*·*gcd*(*a*_{i1}, *a*_{i2}, ..., *a*_{ik}). 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).

Examples

Input

3

3 3 1

Output

12

Input

4

2 3 4 6

Output

39

Note

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

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/06/2024 22:13:51 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|