Factorize arr [ i ] , count and store its factors in cnt
factorize ( arr [ i ] ) ; } foreach ( KeyValuePair < long , long > entry in cnt ) { long ci = entry . Value ; res = ( res * nCrModP ( ci + K - 1 , K - 1 , P ) ) % P ; } return res ; }