#include <iostream>
#include <cmath>

using namespace std;

#define PI 3.1415926535

int main() {
	int n, m;
	while(cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 360;
		int a;
		double men1 = 0.0;
		for (int i = 0; i < n-1; i++) {
			cin >> a;
			men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men1 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
		cin >> m;
		counter = 360;
		double men2 = 0.0;
		for (int i = 0; i < m-1; i++) {
			cin >> a;
			men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men2 += 0.5*1.0*1.0*sin(((double)a/360.0)*PI*2.0);
		if (men1 == men2) {
			cout << 0 << endl;
		} else if (men1 > men2){
			cout << 1 << endl;
		} else {
			cout << 2 << endl;
		}
	}
	return 0;
}