IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2)
G
Move by Prime
Codeforces
3100
原题
← F→
翻译中…

Pussycat Sonya has an array consisting of $*n*$ positive integers. There are $2^{*n*}$ possible subsequences of the array. For each subsequence she counts the minimum number of operations to make all its elements equal. Each operation must be one of two:

翻译中…
  • Choose some element of the subsequence and multiply it by some prime number.
  • Choose some element of the subsequence and divide it by some prime number. The chosen element must be divisible by the chosen prime number.
翻译中…

What is the sum of minimum number of operations for all $2^{*n*}$ possible subsequences? Find and print this sum modulo $10^{9} + 7$.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 300 000$) — the size of the array.

翻译中…

The second line contains $*n*$ integers $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$ ($1 ≤ *t*_{*i*} ≤ 300 000$) — elements of the array.

翻译中…

Output

翻译中…

Print the sum of minimum number of operation for all possible subsequences of the given array modulo $10^{9} + 7$.

翻译中…

Note

翻译中…

In the first sample, there are $8$ possible subsequences: $(60, 60, 40)$, $(60, 60)$, $(60, 40)$, $(60, 40)$, $(60)$, $(60)$, $(40)$ and $()$ (empty subsequence).

翻译中…

For a subsequence $(60, 60, 40)$ we can make all elements equal by two operations — divide $40$ by $2$ to get $20$, and then multiply $20$ by $3$ to get $60$. It's impossible to achieve the goal using less operations and thus we add $2$ to the answer.

翻译中…

There are two subsequences equal to $(60, 40)$ and for each of them the also need to make at least $2$ operations.

翻译中…

In each of other subsequences all numbers are already equal, so we need $0$ operations for each of them. The sum is equal to $2 + 2 + 2 = 6$.

翻译中…

样例

Input #1
3
60 60 40
Output #1
6
InputCopy OutputCopy
Input #2
4
1 2 3 4
Output #2
24
InputCopy OutputCopy
题目信息
题号
653G
时间限制
5 s
内存限制
256 MB
标签
组合数学
数学
数论

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