Why is the first case wrong, 9899767351 is my whatsapp number, please message me if u can provide a meet link

#include
#include<math.h>
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
int b[n]={0};
for(int i=0;i<n;i++){
cin>>a[i];
}

int qn;
cin>>qn;
int q[qn];
for(int i=0;i<qn;i++){
	cin>>q[i];
}

for(int i=0;i<qn;i++){
	int x=q[i];
  
	for(int j=0;j<n;j++){
		if((j-x)<0){
			b[j]=a[j]+a[j-x+n];
		}
		else
		b[j]=a[j]+a[j-x];
	}
    for(int k=0;k<n;k++){
        a[k]=b[k];
    }
}
int sum =0;

for(int i=0;i<n;i++){

sum+=b[i];
}

int mod= pow(10,9)+7;
cout<<sum % mod;

return 0;

}

hi @rounaqkhandelwal24
I can see that u have successfully submitted the code and gained full points…
still if u face any difficulty, u can refer my code -->

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.