John has B blue balls and G green balls and he wants to choose Xblue balls and Y green balls. In how many ways can he choose the balls?
This code is not working for the input
Input
1
50 30 20 10
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli fact (lli n,lli f){
if (n==1 || n==0){
return f;
}
else
{
f*=n;
return fact(n-1,f);
}
}
int main()
{
//write your code here
int t;
cin>>t;
while(t--){
lli b,g,x,y;
cin>>b>>g>>x>>y;
b=fact(b,1)/(fact(x,1)*fact(b-x,1));
g=fact(g,1)/(fact(y,1)*fact(g-y,1));
// cout<<b<<" "<<g<<endl;
cout<<b*g<<endl;
}
return 0;
}
Please help me correct the code.