#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

double get_area(const vector<int>& vs) {
	int ang = 0;
	double res = 0;
	for (auto v : vs) {
		ang += v;
		res += sin(M_PI * v / 180.);
	}
	res += sin(M_PI * (360 - ang) / 180.);
	return res;
}

int main() {
	int m;
	while (cin >> m, m) {
		vector<int> vs1(m - 1);
		for (auto& v : vs1) cin >> v;
		int n;
		cin >> n;
		vector<int> vs2(n - 1);
		for (auto& v : vs2) cin >> v;

		double a = get_area(vs1);
		double b = get_area(vs2);
		if (eq(a, b)) cout << 0 << endl;
		else if (a > b) cout << 1 << endl;
		else cout << 2 << endl;
	}
	return 0;
}