Factorize arr [ i ] , count and store its factors in cnt
factorize ( arr [ i ] ) NEW_LINE for key , value in cnt . items ( ) : NEW_LINE ci = value NEW_LINE res = ( res * nCrModP ( ci + K - 1 , K - 1 , P ) ) % P NEW_LINE return res NEW_LINE