#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>

#define _USE_MATH_DEFINES

using namespace std;

int main(){
	
	while(true){
		
		int m, n;
		
		cin >> m;
		
		if(m == 0){
			break;
		}
		
		vector<int> v1, v2;
		
		int count = 0;
		
		for(int i = 0; i < m - 1; i++){
			int num;
			cin >> num;
			count += num;
			v1.push_back(num);
		}
		
		v1.push_back(360 - count);
		
		cin >> n;
		
		count = 0;
		
		for(int i = 0; i < n - 1; i++){
			int num;
			cin >> num;
			count += num;
			v2.push_back(num);
		}
		
		v2.push_back(360 - count);
		
		double sum1 = 0;
		double sum2 = 0;
		
		sort(v1.begin(), v1.end());
		sort(v2.begin(), v2.end());
		
		for(int i = 0; i < m; i++){
			sum1 += sin(double(v1[i]) * M_PI / 180);
		}
		
		for(int i = 0; i < n; i++){
			sum2 += sin(double(v2[i]) * M_PI / 180);
		}
		
		if(sum1 == sum2){
			cout << "0" << endl;
		}else if(sum1 > sum2){
			cout << "1" << endl;
		}else{
			cout << "2" << endl;
		}
		
	}
	
	return 0;
}