For this problem, I thought my logic like this:
let the number whose prime factorization is given in the array be x, then x=a1^(arr[1])a2^(arr[2])a3^(arr[3])… So, if all the divisors of x are multiplied I am calculating the freq of occuring of each of these primes (a1,a2,…) in that product. We can say a1 must have occured say denote it by temp= (arr[2]+1)(arr[3]+1)… So, each power of a1 from [1,arr[1]] must have occured temp times in that product. The total contribution of a1 in the final product will be temp(arr[1])(arr[1]+1)/2. Similarly we can calculate for other primes. And since answer will be in modulo field, so instead of dividing, I am multiplying modulo multiplicative inverse.
Is there anything wrong with my code/logic?