Help Ramu problem

I can’t find any fault in my program for Help Ramu and am unable to unlock the test case.
Pls suggest a solution to the problem.
#include
using namespace std;
int main() {int a;
cin>>a;
for(int j=0;j!=a;j++)
{
int p,q,r,s,n,m;
cin>>p>>q>>r>>s;
if(p>=1 && p<=1000 && q>=1 && q<=1000 && r>=1 && r<=1000 && s>=1 && s<=1000)
{cin>>n>>m;
if(n>=1 && n<=1000 && m>=1 && m<=1000)
{
int l[n],o[m];
for(int k=0;k<n && l[k-1]>=0 && l[k-1]<=1000;k++)
{
cin>>l[k];
}
for(int k=0;k<m && o[k-1]>=0 && o[k-1]<=1000;k++)
{
cin>>o[k];
}
int answer1=0,answer2=0;
for(int k=0;k<n;k++)
{
answer1=answer1+min(l[k]*p,q);
}answer1=min(answer1,r);
for(int k=0;k<m;k++)
{
answer2=answer2+min(o[k]*p,q);
}answer2=min(answer2,r);
int finalanswer=min(s,answer1+answer2);
cout<<finalanswer<<endl;
}}

}
return 0;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.