#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll NEG = -1e18;
const ll INF = 1e18;
const ll N = 1e6 + 5;
signed main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        if (n == 0)
        {
            cout << 0 << '\n';
            continue;
        }
       
        // dp[i][1] : lấy ở hiện tại (dp[i - 1][0] + a[i])
        // dp[i][0] : bỏ qua không lấy ở lúc này (dp[i - 1][1])
       
        ll x;
        cin >> x;
        ll c0 = 0;
        ll c1 = x;
        for (int i = 2; i <= n; i++)
        {
            cin >> x;
            ll cur1 = max(c0, c1);
            ll cur2 = c0 + x;
            c0 = cur1;
            c1 = cur2;
        }
        cout << max(c0, c1) << '\n';
    }

    return 0;
}
