#include #include #include #include #include #include #include #include #include #include #define PI acos(-1.0) #define CLR(a, b) memset(a, (b), sizeof(a)) #define fi first #define se second #define ll o<<1 #define rr o<<1|1 using namespace std; typedef long long LL; typedef pair pii; const int MAXN = 4*1e3+10; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; void add(LL &x, LL y) { x += y; x %= MOD; } int main() { int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); int v; for(int i = 0; i < n; i++) { scanf("%d", &v); } if(n == 1) { printf("%d\n", v); } else { printf("0\n"); } } return 0; }