Here is my code to the question

```
#include<stdio.h>
#include<math.h>
long int A[100005];
long int sum;
int main(){
int t,n,i,j;
scanf("%d",&t);
while(t--){
sum=0;
scanf("%d",&n);
for(i=0;i<n+1;i++)
scanf("%ld",A+i);
for(i=0;i<=n;i++){
for(j=i+1;j<=n;j++){
if(i!=0){
sum=sum+(A**A[j]*pow(2,n+i-j));
}
if(i==0)
sum=sum+(A**A[j]*pow(2,n+1-j));
}
}
printf("%ld
```

",sum);

}

}

Please help me to find the fault in my code.