Wrong ans on only Test case 1

The code is not working on only Test case 1 and had passed all remaining test cases. Can someone help me

#include <bits/stdc++.h>
using namespace std;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int rem=1e9+7;
int x;cin>>x;
int arr[x];
long long divisors =1; 
for(int i=0;i<x;i++){
    cin>>arr[i];
    divisors = (divisors*(arr[i]+1))%rem;
}
long long int temp;
long long int ans=1;
for(int i=0;i<x;i++){
    temp = (divisors*arr[i]/2+1)%rem;
    ans = (ans*temp)%rem; 
}
cout<<ans;

return 0;

}

@tilakparth123 While taking the modulus add rem before taking a mod. It might overflow and then become -ve.

@tilakparth123 Your answer will fail whenever there will be odd number of divisors. Just check that case.

I have check for odd number of divisors it is working , can you please specify the test case.

@tilakparth123 Your answer is failing for input case 4

Can you please write the test case? As i have checked for
4
1 1 1 1
This gives correct answer
and also
1
2
which means the intial no was 4 which also gaved correct answer, so what do you mean by input case 4

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.