#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n,m;
	while(cin>>m,m)
	{
		double T=2*M_PI,v;
		double A=0;
		for(;--m;)
		{
			cin>>v;
			v=v*M_PI/180;
			T-=v;
			A+=sin(v);
		}
		A+=sin(T);
		T=2*M_PI;
		cin>>n;
		for(;--n;)
		{
			cin>>v;
			v=v*M_PI/180;
			T-=v;
			A-=sin(v);
		}
		A-=sin(T);
		cout<<(abs(A)<1e-10?0:A>0?1:2)<<endl;
	}
}

