Question -- - -- -

Given 3 primes p_1, p_2, p_3 and 3\times 10^4 numbers of the form (p_{1}^{a_{1}} \times p_{2}^{a_{2}} \times p_{3}^{a_{3}}). Calculate the sum of GCDs of all the subsets of the given numbers modulo 10^9 + 7.

0\le a_{1_i} \le 3\times 10^4.
All $a_{1_i}$s are distinct.
0\le a_{2_i}, a_{3_i} \le 10^9.

We might need to lower the constraints a bit I guess. Like 3*10^4 maybe.

what is 3e4 ?
ai or total number of numbers ?

Sorry, I did not see this comment. Well let me modify this a bit.
n, a1 <= 3e4
a2, a3 <= 1e9
All a1 are distinct.

//