#include <iostream>
#include <cmath>

#define PI 3.141592654
#define EPS 1e-10

#define DEG_TO_RAD(theta) theta * PI / 180

struct point {
	double x;
	double y;
};

double getAreaOfTriangle(double sideA, double sideB, double theta)
{
	theta = DEG_TO_RAD(theta);
	return 0.5 * sideA * sideB * sin(theta);
}

int main(void)
{
	while(1) {
		int m;
		double area1 = 0;
		double area2 = 0;
		double theta;
		double lastTheta = 360;

		// 第1の多角形
		std::cin >> m;
		if(m == 0) {
			break;
		}
		for(int i = 0 ; i < m-1 ; i++) {
			std::cin >> theta;
			area1 += getAreaOfTriangle(1, 1, theta);
			lastTheta -= theta;
		}
		area1 += getAreaOfTriangle(1, 1, lastTheta);

		lastTheta = 360;
		// 第2の多角形
		std::cin >> m;
		if(m == 0) {
			break;
		}
		for(int i = 0 ; i < m-1 ; i++) {
			std::cin >> theta;
			area2 += getAreaOfTriangle(1, 1, theta);
			lastTheta -= theta;
		}
		area2 += getAreaOfTriangle(1, 1, lastTheta);

		if(fabs(area1 - area2) < EPS) {
			std::cout << '0' << std::endl;
		}
		else if(area1 > area2) {
			std::cout << '1' << std::endl;
		}
		else if(area1 < area2) {
			std::cout << '2' << std::endl;
		}
	}
	return 0;
}