#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	while (1) {
		int M; cin >> M;
		if (!M)break;
		ld area1=0, area2=0;
		ld sum1 = 0,sum2=0;
		for (int i = 0; i < M-1; ++i) {
			ld v; cin >> v;
			sum1 += v;
			area1 += sin(v / 180 * acos(-1));
		}
		area1 += sin((360-sum1) / 180 * acos(-1));
		int N; cin >> N;
		for (int i = 0; i < N-1; ++i) {
			ld v; cin >> v;
			sum2 += v;
			area2 += sin(v / 180 * acos(-1));
		}
		area2 += sin((360 - sum2) / 180 * acos(-1));
		if (eps > (abs(area1 - area2))) {
			cout << 0 << endl;
		}
		else if (area1 > area2) {
			cout << 1 << endl;
		}
		else {
			cout << 2 << endl;
		}
	}
	return 0;
}