i have coded the solution for this problem. but it is giving wrong answer.
please tell, where i am wrong.
#include<bits/stdc++.h>
using namespace std;
const int inf = (int) 1e9;
int main()
{
long long int t;
cin>>t;
while(t>0){
long long int c1,c2,c3,c4,n,m;
cin>>c1>>c2>>c3>>c4;
cin>>n>>m;
int a[n],b[m];
long long int mina=inf,minb=inf,suma=0,sumb=0;
for( int i=0;i<n;i++)
cin>>a[i];
for( int i=0;i<m;i++)
cin>>b[i];
for( int i=0;i<n;i++){
if(a[i] < mina)
mina=a[i];
suma += a[i];
}
for( int i=0;i<m;i++){
if(b[i] < minb)
minb=b[i];
sumb += b[i];
}
long long int k=0,p=0,q=0;
p = min(suma*c1 , (mina*c1 + c2));
p = min(p,c3);
q = min(sumb*c1 , (minb*c1 + c2));
q = min(q,c3);
k = min(c4,p+q);
cout<<k;
cout<<endl;
t--;
}
return 0;
}