#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
ll ans = accumulate(a.begin(), a.end(), 0ll);
for (int i = 1; i < n; i++) {
ll sum = 0;
for (int j = n - 1; j >= i; j--) {
a[j] -= a[j - 1];
sum += a[j];
}
ans = max(max(ans, sum), -sum);
}
cout << ans << endl;
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp1c2luZyBsbCA9IGxvbmcgbG9uZzsKCnZvaWQgc29sdmUoKSB7CglpbnQgbjsKCWNpbiA+PiBuOwoJdmVjdG9yPGxsPiBhKG4pOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIGNpbiA+PiBhW2ldOwoJbGwgYW5zID0gYWNjdW11bGF0ZShhLmJlZ2luKCksIGEuZW5kKCksIDBsbCk7Cglmb3IgKGludCBpID0gMTsgaSA8IG47IGkrKykgewoJCWxsIHN1bSA9IDA7CgkJZm9yIChpbnQgaiA9IG4gLSAxOyBqID49IGk7IGotLSkgewoJCQlhW2pdIC09IGFbaiAtIDFdOwoJCQlzdW0gKz0gYVtqXTsKCQl9CgkJYW5zID0gbWF4KG1heChhbnMsIHN1bSksIC1zdW0pOwoJfQoJY291dCA8PCBhbnMgPDwgZW5kbDsJCQp9CgppbnQgbWFpbigpIHsKCWludCB0OwoJY2luID4+IHQ7Cgl3aGlsZSAodC0tKSBzb2x2ZSgpOwp9