#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N = 1e3 + 10,mod = 1e9 + 7;
int a[N],dp[N][2];
int n;
void solve(){
cin >> n;
int sum = 0;
for(int i = 1; i <= n ; i ++) dp[i][0] = dp[i][1] = 0;
dp[0][0] = 1;
for(int i = 1 ; i <= n ; i ++) {
cin >> a[i];
sum += a[i];
}
if(sum%2){
cout << 0 << endl;
return;
}
for(int i = 1; i <= n ; i ++)
{
if(a[i]%2==0){
dp[i][0] = (dp[i-1][0]+dp[i-1][0])%mod;
dp[i][1] = (dp[i-1][1]+dp[i-1][1])%mod;
}else{
dp[i][0] = (dp[i-1][1]+dp[i-1][0])%mod;
dp[i][1] = (dp[i-1][0]+dp[i-1][1])%mod;
}
}
cout << dp[n][0] << endl;
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int _ = 1;
cin >> _;
while(_--) solve();
return 0;
}