#include <iostream>
#include <cmath>

using namespace std;

#define PI acos(-1.0)

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		double a = 0.0;
		int cc = 360;
		int k;
		for (int i = 0; i < n-1; i++) {
			cin >> k;
			a += sin(PI*((double)k/360.0));
			cc -= k;
			//cout << a << endl;
		}
		a += sin(PI*((double)cc/360.0));
		int n2;
		cin >> n2;
		double b = 0.0;
		cc = 360;
		for (int i = 0; i < n2-1; i++) {
			cin >> k;
			b += sin(PI*((double)k/360.0));
			cc -= k;
			//cout << b << endl;
		}
		b += sin(PI*((double)cc/360.0));
		//cout << a << ' ' << b << endl;
		if (a == b) {
			cout << 0 << endl;
		} else if (a > b) {
			cout << 1 << endl;
		} else {
			cout << 2 << endl;
		}
	}
	return 0;
}