#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

const double PI = acos(-1);

typedef complex<double> P;
typedef P Vec;

double solve(int n) {
	vector<int> angle(n, 0);
	
	int in;
	FOR(i, 1, n) {
		scanf("%d", &in);
		angle[i] = angle[i - 1] + in;
	}
	
	double res = 0.0;
	REP(i, n) {
		P p1 = P(cos(angle[i] * PI / 180), sin(angle[i] * PI / 180));
		P p2 = P(cos(angle[(i + 1) % n] * PI / 180), sin(angle[(i + 1) % n] * PI / 180));
		
		double a = abs(p1), b = abs(p2 - p1), c = abs(p2);
		double s = (a + b + c) / 2.0;
		double S = sqrt(s * (s - a) * (s - b) * (s - c));
		res += S;
	}
	return res;
}

int main() {
	int m, n;
	while (cin >> m, m) {
		double s1 = solve(m);
		cin >> n;
		double s2 = solve(n);
		
		if (s1 >= s2 - EPS && s1 <= s2 + EPS)
			puts("0");
		else if (s1 > s2 + EPS)
			puts("1");
		else
			puts("2");
	}
	
	return 0;
}