can you please help me to figure out what is wrong with my code
#include
using namespace std;
int main() {
int n,a,b,c,d,x,y;
cin>>n;
int sum=0;
int osum=0;
int esum=0;
int i=0;
while(i<n){
cin>>a>>b>>c>>d;
cin>>x>>y;
int u=0;
while(u<x){
int w;
sum=0;
cin>>w;
sum+=a*w;
if(sum>b){
sum=b;
}
osum+=sum;
u++;
}
if(osum>c){
osum=c;
}
int k=0;
sum=0;
while(k<y){
sum=0;
int g=0;
cin>>g;
sum+=a*g;
if(sum>b){
sum=b;
}
esum+=sum;
k++;
}
if(esum>c){
esum=c;
}
i++;
int usum=osum+esum;
if(usum>d){
usum=d;
}
cout<<usum<<endl;
}
}