Help ramu, bruteforce

My code works fine on my ide but hackerblocks showing wrong answer dont know why , please help !

#include
using namespace std;
int main()
{
int test;
cin>>test;
int cabc[1000],rickc[1000];
int c1,c2,c3,c4,cab,rick,i;
while(test>0)
{

     cin>>c1>>c2>>c3>>c4;
     cin>>cab>>rick;
	

	 for (i=0;i<cab;i++)
	 {
		 cin>>cabc[i];
	 }

	 for(i=0;i<rick;i++)
	 {
		 cin>>rickc[i];
	 }
	 int sum1=0;
	 int sum2=0;
	 int sum=0;

	  for (i=0;i<cab;i++)
	 {
		 if(cabc[i]<c2)
		 {
           sum1=sum1+cabc[i];
		 }
		 else
		   {
			   sum1=sum1+c2;
		   }
	 }
	 if(sum1>c3)
	 {
		 sum1=c3;
	 }


	  for (i=0;i<rick;i++)
	 {
		 if(rickc[i]<c2)
		 {
           sum2=sum2+rickc[i];
		 }
		 else
		   {
			   sum2=sum2+c2;
		   }
	 }
	 if(sum2>c3)
	 {
		 sum2=c3;
	 }

	 if((sum1+sum2)>c4)
	 {
		 sum=c4;
	 }
	 else
	 {
		 sum=sum1+sum2;
	 }
    

	 cout<<sum<<endl;





  test--;

}
return 0;
}

Nischay, I would recommend you to go through the online video ,


and change your logic according to the approach mentioned…

Since, you arent replying anything, I am marking this doubt as resolved… You can reopen it if u still face any issues…