#include<cstdio>
#include<cmath>
#include<numeric>
using namespace std;
double Square(double x){return x*x;}
double D2R(double x){return x/180*3.14159265358979;}

double Area2(int angle[], double r, int n)
{
	double result=0;
	double s,a,b,c;
	for(int i = 0; i < n-1; ++i)
	{
		a=b=r;
		c=sqrt( Square( cos(D2R(angle[i])) - cos(D2R(angle[i]+angle[i+1])) ) +
				Square( sin(D2R(angle[i])) - sin(D2R(angle[i]+angle[i+1])) ) );
		s=(a+b+c)/2;
		result += (s*(s-a)*(s-b)*(s-c));
	}
	return result;
}
int main()
{
	int n,m,angle[360],i;
	double s1,s2;
	while(scanf("%d",&m),m)
	{
		for(i = 0; i < m-1; ++i)
			scanf("%d",&angle[i]);
		angle[m-1] = 360-accumulate(angle,angle+m-1,0);
		s1 = Area2(angle, 1, m);
		scanf("%d", &n);
		for(i = 0; i < n-1; ++i)
			scanf("%d", &angle[i]);
		angle[n-1] = 360-accumulate(angle, angle+n-1,0);
		s2 = Area2(angle, 1, n);
		if(fabs(s1-s2)<0.001)
			puts("0");
		else if(s1>s2)
			puts("1");
		else puts("2");
	}
	return 0;
}