#include <bits/stdc++.h>
using namespace std;
int T,n,a,b;
int A[1005];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> T;
while(T--)
{
a = 0;
b = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> A[i];
if(i <= n/2) a += A[i];
else b += A[i];
}
cout << a*b << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgVCxuLGEsYjsKaW50IEFbMTAwNV07CmludCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKE5VTEwpOwogICAgY2luID4+IFQ7CiAgICB3aGlsZShULS0pCiAgICB7CiAgICAJYSA9IDA7CiAgICAJYiA9IDA7CiAgICAgICAgY2luID4+IG47CiAgICAgICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspCiAgICAgICAgewogICAgICAgICAgICBjaW4gPj4gQVtpXTsKICAgICAgICAgICAgaWYoaSA8PSBuLzIpIGEgKz0gQVtpXTsKICAgICAgICAgICAgZWxzZSBiICs9IEFbaV07CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgYSpiIDw8IGVuZGw7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==