#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI 3.141592653589793238462643383279
#define EPS 10e-8

using namespace std;

int main()
{
	int m, n;
	int sum;
	vector <double> sa, sb;

	for (;; ){
		cin >> m;
		if (!m )
			break; 
		vector <int> a (m, 0 );
		sum = 0;
		rep (i, m - 1 ){
			cin >> a[i];
			sum += a[i];
		} // end rep
		a[m-1] = 360 - sum;
		cin >> n;
		vector <int> b (n, 0 );
		sum = 0;
		rep (j, n-1 ){
			cin >> b[j];
			sum += b[j];
		} // end rep
		b[n-1] = 360 - sum;
		double s = 0.0, t = 0.0;
		rep (i, m )
			s += sin ((double)a[i]*PI/180. );
		sa.push_back (s );
		rep (j, n )
			t += sin ((double)b[j]*PI/180. );
		sb.push_back (t );
	} // end for

	int size = sa.size();
	rep (i, size ){
//		sa[i] = fabs (sa[i] ); sb[i] = fabs (sb[i] );
		if (sa[i] > sb[i]+EPS ){
			cout << '1' << endl;
		}else if (sa[i]+EPS < sb[i] ){
			cout << '2' << endl;
		}else{
			cout << '0' << endl;
		} // end if 
	} // end for

	return 0;
}