#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("Ofast, unroll-loops, fast-math, no-stack-protector, inline")
#pragma GCC target("avx2")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define int long long

const ll INF = 1e18 + 228;
const ll mod = 1e9 + 7;
const ld eps = 1e-8;

random_device rd;
mt19937 rnd(rd() + 228 + 57 - 179);

void solve() {
    int n;
    cin >> n;
    ll z1 = 0, z2 = 0;
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        if (rnd() & 1) z1 = x - z1;
        else z2 = x - z2;
    }
    cout << z1 + z2 << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int tt = 1;
    cin >> tt;
    while (tt--) solve();
    return 0;
}
