#include<bits/stdc++.h>
using namespace std;
long long t,n;
const int Nmax=100000+5;
long long a[Nmax];
long long ans(int i){
if(i>=n)
return 0;
long long x,y,z;
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 max(x,max(y,z));
}
int main(){
cin>>t;
while(t--){
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
cout<<ans(0)<<endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKbG9uZyBsb25nIHQsbjsKY29uc3QgaW50IE5tYXg9MTAwMDAwKzU7CmxvbmcgbG9uZyBhW05tYXhdOwoKbG9uZyBsb25nIGFucyhpbnQgaSl7CiAgICBpZihpPj1uKQogICAgICAgIHJldHVybiAwOwogICAgbG9uZyBsb25nIHgseSx6OwogICAgaWYoaTxuKQogICAgICAgIHg9YVtpXSthbnMoaSsyKTsKICAgIGlmKGkrMTxuKQogICAgICAgIHk9YVtpXSthW2krMV0rYW5zKGkrNCk7CiAgICBpZihpKzI8bikKICAgICAgICB6PWFbaV0rYVtpKzFdK2FbaSsyXSthbnMoaSs2KTsKICAgIHJldHVybiBtYXgoeCxtYXgoeSx6KSk7Cn0KCmludCBtYWluKCl7CiAgICBjaW4+PnQ7CiAgICB3aGlsZSh0LS0pewogICAgICAgIGNpbj4+bjsKICAgICAgICBmb3IoaW50IGk9MDtpPG47aSsrKQogICAgICAgICAgICBjaW4+PmFbaV07CiAgICAgICAgY291dDw8YW5zKDApPDxlbmRsOwogICAgfQp9