Multiplying result with the modulo multiplicative inverse of factorial of count of i
for ( int i = 0 ; i < 10 ; i ++ ) { result = ( result * modInverse ( factorial [ ( int ) count [ i ] ] , m ) ) % m ; }