#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[361],i,j;
	while(scanf("%d",&m),m)
	{
		double s[2];
		int count[2]={m};
		for(i=0;i<2;++i)
		{
			angle[0]=0;
			for(j=1; j<count[i]; ++j) scanf("%d",&angle[j]);
			angle[count[i]] = 360-accumulate(angle,angle+count[i],0);
			s[i] = Area2(angle, 1, count[i]+1);

			if(i==0)scanf("%d",&n),count[1]=n;
		}
		if(fabs(s[0]-s[1])<0.001) puts("0");
		else if(s[0]>s[1]) puts("1");
		else puts("2");
	}
	return 0;
}