Base case
if N <= 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT fact = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT fact = ( fact * i ) % Mod NEW_LINE DEDENT return power ( fact , Mod - 2 , Mod ) NEW_LINE