#include<stdio.h>
#include<math.h>
double PI=atan(1.)*4;
double F(int n,double*x,double*y)
{
	double res=0;
	for(int i=1;i+1<n;++i)
		res+=((x[i]-x[0])*(y[i+1]-y[0])-(y[i]-y[0])*(x[i+1]-x[0]))/2;
	return res;
}
void I(int n,double*x,double*y)
{
	int a,i,t;
	for(i=a=0;i<n;)
	{
		x[i]=cos(a*PI/180);
		y[i]=sin(a*PI/180);
		if(++i<n)scanf("%d",&t),a+=t;
	}
}
int main()
{
	int n;
	double s,t,x[360],y[360];;
	while(scanf("%d",&n),n)
	{
		I(n,x,y);
		s=F(n,x,y);
		scanf("%d",&n);
		I(n,x,y);
		t=F(n,x,y);
		puts(fabs(s-t)<1e-9?"0":s>t?"1":"2");
	}
}