#include <bits/stdc++.h>

using namespace std;

const double PI = 3.1415926;

int main() {
	int m, n, degree, rest;
	double sum1, sum2;

	while (cin >> m, m) {
		sum1 = rest = 0;
		for (int i = 1; i < m; i++) {
			cin >> degree;
			rest += degree;
			sum1 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum1 += sin(degree*PI / 180.0);
		//cout << "sum1="<<sum1 << endl;

		cin >> n;
		sum2 = rest = 0;
		for (int i = 1; i < n; i++) {
			cin >> degree;
			rest += degree;
			sum2 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum2 += sin(degree*PI / 180.0);
		//cout << "sum2"<<sum2 << endl;

		if (fabs(sum1 - sum2) < 1e-10) {
			cout << "0" << endl;
		}
		else if (sum1 < sum2) {
			cout << "2" << endl;
		}
		else {
			cout << "1" << endl;
		}
	}

	return 0;
}

