Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-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.

No tag edit access

C. Little Elephant and LCM

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThe Little Elephant loves the LCM (least common multiple) operation of a non-empty set of positive integers. The result of the LCM operation of *k* positive integers *x*_{1}, *x*_{2}, ..., *x*_{k} is the minimum positive integer that is divisible by each of numbers *x*_{i}.

Let's assume that there is a sequence of integers *b*_{1}, *b*_{2}, ..., *b*_{n}. Let's denote their LCMs as *lcm*(*b*_{1}, *b*_{2}, ..., *b*_{n}) and the maximum of them as *max*(*b*_{1}, *b*_{2}, ..., *b*_{n}). The Little Elephant considers a sequence *b* good, if *lcm*(*b*_{1}, *b*_{2}, ..., *b*_{n}) = *max*(*b*_{1}, *b*_{2}, ..., *b*_{n}).

The Little Elephant has a sequence of integers *a*_{1}, *a*_{2}, ..., *a*_{n}. Help him find the number of good sequences of integers *b*_{1}, *b*_{2}, ..., *b*_{n}, such that for all *i* (1 ≤ *i* ≤ *n*) the following condition fulfills: 1 ≤ *b*_{i} ≤ *a*_{i}. As the answer can be rather large, print the remainder from dividing it by 1000000007 (10^{9} + 7).

Input

The first line contains a single positive integer *n* (1 ≤ *n* ≤ 10^{5}) — the number of integers in the sequence *a*. The second line contains *n* space-separated integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{5}) — sequence *a*.

Output

In the single line print a single integer — the answer to the problem modulo 1000000007 (10^{9} + 7).

Examples

Input

4

1 4 3 2

Output

15

Input

2

6 3

Output

13

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/19/2018 14:57:53 (d1).

Desktop version, switch to mobile version.

User lists

Name |
---|