CF653G.Move by Prime

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Pussycat Sonya has an array consisting of nn positive integers. There are 2n2^{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 2n2^{n} possible subsequences? Find and print this sum modulo 109+710^{9}+7 .

输入格式

The first line of the input contains a single integer nn ( 1<=n<=3000001<=n<=300000 ) — the size of the array.

The second line contains nn integers t1,t2,...,tnt_{1},t_{2},...,t_{n} ( 1<=ti<=3000001<=t_{i}<=300000 ) — elements of the array.

输出格式

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

输入输出样例

  • 输入#1

    3
    60 60 40
    

    输出#1

    6
    
  • 输入#2

    4
    1 2 3 4
    

    输出#2

    24
    

说明/提示

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

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

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

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

首页