Generating inverse of factorials modulo MOD of all numbers
inv [ MAX - 1 ] = modInverse ( fact [ MAX - 1 ] ) NEW_LINE i = MAX - 2 NEW_LINE while ( i >= 0 ) : NEW_LINE INDENT inv [ i ] = ( inv [ i + 1 ] * ( i + 1 ) ) NEW_LINE inv [ i ] %= MOD NEW_LINE i -= 1 NEW_LINE DEDENT