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

const double EPS = 1e-9;

int main() {
	int m;
	while(cin >> m, m) {
		vector<int> v0, v1;
		int n;

		int sum = 0;
		for(int i = 0; i < m - 1; i++) {
			int tmp;
			cin >> tmp;
			v0.push_back(tmp);
			sum += tmp;
		}
		v0.push_back(360 - sum);

		cin >> n;
		sum = 0;
		for(int i = 0; i < n - 1; i++) {
			int tmp;
			cin >> tmp;
			v1.push_back(tmp);
			sum += tmp;
		}
		v1.push_back(360 - sum);

		double s0 = 0, s1 = 0;
		for(int i = 0; i < v0.size(); i++) {
			s0 += sin(M_PI * v0[i] / 360.0);
		}
		for(int i = 0; i < v1.size(); i++) {
			s1 += sin(M_PI * v1[i] / 360.0);
		}

		if(fabs(s0 - s1) < EPS)
			cout << 0 << endl;
		else if(s0 > s1)
			cout << 1 << endl;
		else
			cout << 2 << endl;
	}
}