#include <iostream>
#include <cmath>
using namespace std;

double calc( double* sinv, int x )
{
	double xv = 0.0;
	int angle = 360;
	for( int i = 0; i < x - 1; ++i ){
		int a;
		cin >> a;
		xv += sinv[ a ];
		angle -= a;
	}
	xv += sinv[ angle ];
	return xv;
}

int main()
{
	double sinv[ 180 ] = {0.0};
	for( int i = 1; i <= 90; ++i ){
		sinv[ i ] = sinv[ 180 - i ] = sin( static_cast<double>( i ) );
	}

	int m, n;
	while( cin >> m && m ){
		double mv = calc( sinv, m );
		cin >> n;
		double nv = calc( sinv, n );
		int ans = 0;
		if( mv > nv ){
			ans = 1;
		}else if( mv < nv ){
			ans = 2;
		}
		cout << ans << endl;
	}
	return 0;
}