#include<bits/stdc++.h>
using namespace std;
long long t,n;
const int Nmax=100010;
long long a[Nmax];
long long dp[Nmax];
long long ans(int i){
if(i>=n)
return 0;
if(dp[i]==-1){
long long x=0,y=0,z=0;
if(i<n)
x=a[i]+ans(i+2);
if(i+1<n)
y=a[i]+a[i+1]+ans(i+4);
if(i+2<n)
z=a[i]+a[i+1]+a[i+2]+ans(i+6);
return dp[i]=max(x,max(y,z));}
else return dp[i];
}
int main(){
cin>>t;
while(t--){
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
memset(dp,-1,sizeof dp);
cout<<ans(0)<<endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbG9uZyBsb25nIHQsbjsKY29uc3QgaW50IE5tYXg9MTAwMDEwOwpsb25nIGxvbmcgYVtObWF4XTsKbG9uZyBsb25nIGRwW05tYXhdOwpsb25nIGxvbmcgYW5zKGludCBpKXsKICAgIGlmKGk+PW4pCiAgICAgICAgcmV0dXJuIDA7CiAgICBpZihkcFtpXT09LTEpewogICAgbG9uZyBsb25nIHg9MCx5PTAsej0wOwogICAgaWYoaTxuKQogICAgICAgIHg9YVtpXSthbnMoaSsyKTsKICAgIGlmKGkrMTxuKQogICAgICAgIHk9YVtpXSthW2krMV0rYW5zKGkrNCk7CiAgICBpZihpKzI8bikKICAgICAgICB6PWFbaV0rYVtpKzFdK2FbaSsyXSthbnMoaSs2KTsKICAgIHJldHVybiBkcFtpXT1tYXgoeCxtYXgoeSx6KSk7fQogICAgZWxzZSByZXR1cm4gZHBbaV07Cn0KCmludCBtYWluKCl7CiAgICBjaW4+PnQ7CiAgICB3aGlsZSh0LS0pewogICAgICAgIGNpbj4+bjsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgICAgICBjaW4+PmFbaV07CiAgICAgICAgbWVtc2V0KGRwLC0xLHNpemVvZiBkcCk7CiAgICAgICAgY291dDw8YW5zKDApPDxlbmRsOwogICAgfQp9