human
Total ways of choosing X men and Y women from a total of M men and W women | Function to return the value of ncr effectively.
Initialize the answer.
Divide simultaneously by i to avoid overflow.
Function to return the count of required ways ;"
How can the above be solved in Python?
 ... What is a code to total ways of choosing X men and Y women from a total of M men and W women and the other steps required?
assistant
#Here is code to total ways of choosing X men and Y women from a total of M men and W women and the other steps required.
 def ncr ( n , r ) :
	ans = 1
	for i in range ( 1 , r + 1 ) :
		ans *= ( n - r + i )
		ans //= i
	return ans
def totalWays ( X , Y , M , W ) :
	return ( ncr ( M , X ) * ncr ( W , Y ) )
/ * Driver code * /
X = 4
Y = 3
M = 6
W = 5
print ( totalWays ( X , Y , M , W ) )