import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import static java.
lang.
Math.
*;
final boolean ONLINE_JUDGE
= System.
getProperty("ONLINE_JUDGE") != null;
if (ONLINE_JUDGE){
//in = new BufferedReader(new InputStreamReader(System.in));
//out = new PrintWriter(System.out);
}else{
// in = new BufferedReader(new FileReader("input.txt"));
//out = new PrintWriter("output.txt");
}
}
while(!tok.hasMoreTokens()){
try{
return null;
}
}
return tok.nextToken();
}
return Integer.
parseInt(readString
()); }
return Long.
parseLong(readString
()); }
return Double.
parseDouble(readString
()); }
public static void main
(String[] args
){ new Thread(null,
new Solve
(),
"",
256 * (1L
<< 20)).
start(); }
long timeBegin, timeEnd;
void time(){
timeEnd
= System.
currentTimeMillis(); System.
err.
println("Time = " + (timeEnd
- timeBegin
)); }
void debug
(Object...
objects){ if (!ONLINE_JUDGE){
System.
err.
println(o.
toString()); }
}
}
int sm(int x){
if (x==1) return 0;else return 1;
}
int gcd(int a,int b){
if (b==0) return a;
else{
return gcd(b,a%b);
}
}
int n=readInt();
for (int i=0;i<n;i++){
int k=readInt();
int[] a=new int[k];
for (int j=0;j<k;j++){
a[j]=readInt();
}
long k1=0;
for (int j=0;j<k/2;j++){
k1+=(long)a[j];
}
int k2=0;
for (int j=k/2;j<k;j++){
k2+=(long)a[j];
}
out.
println(Math.
abs(k2
-k1
));
}
}
public void run(){
try{
timeBegin
= System.
currentTimeMillis();
solve();
out.close();
//time();
e.
printStackTrace(System.
err); }
}
}
aW1wb3J0IGphdmEuYXd0LlBvaW50OwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS5tYXRoLkJpZ0ludGVnZXI7CmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEudXRpbC5NYXAuRW50cnk7CgppbXBvcnQgc3RhdGljIGphdmEubGFuZy5NYXRoLio7CgpwdWJsaWMgY2xhc3MgU29sdmUgaW1wbGVtZW50cyBSdW5uYWJsZXsKICAgIApmaW5hbCBib29sZWFuIE9OTElORV9KVURHRSA9IFN5c3RlbS5nZXRQcm9wZXJ0eSgiT05MSU5FX0pVREdFIikgIT0gbnVsbDsKICAgIAogICAgQnVmZmVyZWRSZWFkZXIgaW47CiAgICBQcmludFdyaXRlciBvdXQ7CiAgICBTdHJpbmdUb2tlbml6ZXIgdG9rID0gbmV3IFN0cmluZ1Rva2VuaXplcigiIik7CiAgICAKICAgIHZvaWQgaW5pdCgpIHRocm93cyBGaWxlTm90Rm91bmRFeGNlcHRpb257CiAgICAgICAgaWYgKE9OTElORV9KVURHRSl7CiAgICAgICAgICAgIC8vaW4gPSBuZXcgQnVmZmVyZWRSZWFkZXIobmV3IElucHV0U3RyZWFtUmVhZGVyKFN5c3RlbS5pbikpOwogICAgICAgICAgICAvL291dCA9IG5ldyBQcmludFdyaXRlcihTeXN0ZW0ub3V0KTsKICAgICAgICAgICAgCiAgICAgICAgICAgIGluID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBGaWxlUmVhZGVyKCIwOCIpKTsKICAgICAgICAgICAgb3V0ID0gbmV3IFByaW50V3JpdGVyKCJvdXRwdXQudHh0Iik7CiAgICAgICAgfWVsc2V7ICAKICAgICAgICAJaW4gPSBuZXcgQnVmZmVyZWRSZWFkZXIobmV3IEZpbGVSZWFkZXIoIjA4IikpOwogICAgICAgICAgICBvdXQgPSBuZXcgUHJpbnRXcml0ZXIoIm91dHB1dC50eHQiKTsKICAgICAgICAgICAgIC8vIGluID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBGaWxlUmVhZGVyKCJpbnB1dC50eHQiKSk7CiAgICAgICAgICAgIC8vb3V0ID0gbmV3IFByaW50V3JpdGVyKCJvdXRwdXQudHh0Iik7CiAgICAgICAgfQogICAgfQogICAgCiAgICBTdHJpbmcgcmVhZFN0cmluZygpIHRocm93cyBJT0V4Y2VwdGlvbnsKICAgICAgICB3aGlsZSghdG9rLmhhc01vcmVUb2tlbnMoKSl7CiAgICAgICAgICAgIHRyeXsKICAgICAgICAgICAgICAgIHRvayA9IG5ldyBTdHJpbmdUb2tlbml6ZXIoaW4ucmVhZExpbmUoKSk7CiAgICAgICAgICAgIH1jYXRjaCAoRXhjZXB0aW9uIGUpewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRvay5uZXh0VG9rZW4oKTsKICAgIH0KICAgIAogICAgaW50IHJlYWRJbnQoKSB0aHJvd3MgSU9FeGNlcHRpb257CiAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQocmVhZFN0cmluZygpKTsKICAgIH0KICAgIAogICAgbG9uZyByZWFkTG9uZygpIHRocm93cyBJT0V4Y2VwdGlvbnsKICAgICAgICByZXR1cm4gTG9uZy5wYXJzZUxvbmcocmVhZFN0cmluZygpKTsKICAgIH0KICAgIAogICAgZG91YmxlIHJlYWREb3VibGUoKSB0aHJvd3MgSU9FeGNlcHRpb257CiAgICAgICAgcmV0dXJuIERvdWJsZS5wYXJzZURvdWJsZShyZWFkU3RyaW5nKCkpOwogICAgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKXsKICAgICAgICBuZXcgVGhyZWFkKG51bGwsIG5ldyBTb2x2ZSgpLCAiIiwgMjU2ICogKDFMIDw8IDIwKSkuc3RhcnQoKTsKICAgIH0KICAgIAogICAgbG9uZyB0aW1lQmVnaW4sIHRpbWVFbmQ7CgogICAgdm9pZCB0aW1lKCl7CiAgICAgICAgdGltZUVuZCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwogICAgICAgIFN5c3RlbS5lcnIucHJpbnRsbigiVGltZSA9ICIgKyAodGltZUVuZCAtIHRpbWVCZWdpbikpOwogICAgfQogICAgCiAgICB2b2lkIGRlYnVnKE9iamVjdC4uLiBvYmplY3RzKXsKICAgICAgICBpZiAoIU9OTElORV9KVURHRSl7CiAgICAgICAgICAgIGZvciAoT2JqZWN0IG86IG9iamVjdHMpewogICAgICAgICAgICAgICAgU3lzdGVtLmVyci5wcmludGxuKG8udG9TdHJpbmcoKSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICAKICAgIGludCBzbShpbnQgeCl7CiAgICAgICAgaWYgKHg9PTEpIHJldHVybiAwO2Vsc2UgcmV0dXJuIDE7CiAgICB9CiAgICAKICAgIGludCBnY2QoaW50IGEsaW50IGIpewogICAgICAgIGlmIChiPT0wKSByZXR1cm4gYTsKICAgICAgICBlbHNlewogICAgICAgICAgICByZXR1cm4gZ2NkKGIsYSViKTsKICAgICAgICB9CiAgICB9IAogICAgCiAgICAKICAgICAgIAogICAgCiAgICAKICAgCiAgCiAgIAogICAKICAgIAogICAgCiAgICAKICAgIAogICBwdWJsaWMgdm9pZCBzb2x2ZSgpIHRocm93cyBJT0V4Y2VwdGlvbnsKCSAgIGludCBuPXJlYWRJbnQoKTsgIAoJICAKCSAgIGZvciAoaW50IGk9MDtpPG47aSsrKXsKCQkgICBpbnQgaz1yZWFkSW50KCk7CgkJICAgaW50W10gYT1uZXcgaW50W2tdOwoJCSAgIGZvciAoaW50IGo9MDtqPGs7aisrKXsKCQkJICAgYVtqXT1yZWFkSW50KCk7CgkJICAgfQoJCSAgIEFycmF5cy5zb3J0KGEpOwoJCSAgIGxvbmcgazE9MDsKCQkgICBmb3IgKGludCBqPTA7ajxrLzI7aisrKXsKCQkJICAgazErPShsb25nKWFbal07CgkJICAgfQoJCSAgIGludCBrMj0wOwoJCSAgIGZvciAoaW50IGo9ay8yO2o8aztqKyspewoJCQkgICBrMis9KGxvbmcpYVtqXTsKCQkgICB9CQkgICAKCQkgICBvdXQucHJpbnRsbihNYXRoLmFicyhrMi1rMSkpOyAKCQkgICAKCSAgIH0KCSAgCgkgICAKCSAgIAoKCSAgIAoJICAgCgkgICAKCSAgIAoJICAgCgkgICAKCSAgIAoJICAgCiAgIH0KICAgICAgICAKICAgICAgICAKICAgICAgICAKICAgIAogICAgCiAgICBwdWJsaWMgdm9pZCBydW4oKXsKICAgICAgICB0cnl7CiAgICAgICAgICAgIHRpbWVCZWdpbiA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOyAgICAgIAogICAgICAgICAgICAKICAgICAgICAgICAgCiAgICAgICAgICAgIGluID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihTeXN0ZW0uaW4pKTsKICAgICAgICAgICAgb3V0ID0gbmV3IFByaW50V3JpdGVyKFN5c3RlbS5vdXQpOwogICAgICAgICAgICAKICAgICAgICAgICAgCiAgICAgICAgICAgIHNvbHZlKCk7CiAgICAgICAgICAgIAogICAgICAgICAgICBvdXQuY2xvc2UoKTsKICAgICAgICAgICAgLy90aW1lKCk7CiAgICAgICAgfWNhdGNoIChFeGNlcHRpb24gZSl7CiAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKFN5c3RlbS5lcnIpOwogICAgICAgICAgICBTeXN0ZW0uZXhpdCgtMSk7CiAgICAgICAgfQogICAgfQogICAgCiAgICAKfQ==