Number of ways to distribute N Paper Set among M students | Python3 implementation of the approach ; Function to return n ! % 1000000007 ; To store the factorial ; Find the factorial ; Function to return the count of possible ways ; Driver code
MOD = 1000000007 ; NEW_LINE def factMod ( n ) : NEW_LINE INDENT fact = 1 ; NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT fact *= ( i % MOD ) ; NEW_LINE fact %= MOD ; NEW_LINE DEDENT return fact ; NEW_LINE DEDENT def countWays ( n , m ) : NEW_LINE INDENT return factMod ( m ) ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 2 ; m = 2 ; NEW_LINE print ( countWays ( n , m ) ) ; NEW_LINE DEDENT