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

double degToRad(double deg){
	return M_PI * deg / 180;
}

int main() {
	int n, m;
	int angle;
	int v;
	double area1, area2;
	double E = 0.0000000000001f;
	
	while(cin >> n, n){
		area1 = area2 = 0;
		
		angle = 0;
		for(int i = 0; i < n - 1; ++i){
			cin >> v;
			area1 += sin(degToRad(v));
			angle += v;
		}
		area1 += sin(degToRad(360 - angle));
		
		cin >> m;
		
		angle = 0;
		for(int i = 0; i < m - 1; ++i){
			cin >> v;
			area2 += sin(degToRad(v));
			angle += v;
		}
		area2 += sin(degToRad(360 - angle));
		
		//cout << area1 << " " << area2 << " ";
		
		if(fabs(area1 - area2) < E){
			cout << 0 << endl;
		}else if(area1 > area2){
			cout << 1 << endl;
		}else{
			cout << 2 << endl;
		}
	}
	return 0;
}