#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int a, b;
	while(cin >> a, a){
		vector<int> n(a);
		int suma = 0, sumb = 0;
		rep(i, a-1){cin >> n[i]; suma += n[i];}
		n[a-1] = 360-suma;
		cin >> b;
		vector<int> m(b);
		rep(i, b-1){cin >> m[i]; sumb += m[i];}
		m[b-1] = 360-sumb;

		double p=0., q = 0.;
		rep(i, a) p += sin(n[i] * M_PI / 180);
		rep(i, b) q += sin(m[i] * M_PI / 180);


		if(abs(p-q) < eps) cout << 0 << endl;
		else if(p > q) cout << 1 << endl;
		else cout << 2 << endl;
	}
}