#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int m,n;
	double sum1,sum2,degree,rest1,rest2;

	while(true){
		scanf("%d",&m);
		if(m == 0)break;

		sum1 = sum2 = 0;
		rest1 = 0,rest2 = 0;

		for(int i = 0; i < m-1; i++){
			scanf("%lf",&degree);
			sum1 += sin((M_PI*degree)/180);
			rest1 += degree;
		}

		rest1 = 360 - rest1;
		sum1 += sin((M_PI*rest1)/180);

		scanf("%d",&n);

		for(int i = 0; i < n-1; i++){
			scanf("%lf",&degree);
			sum2 += sin((M_PI*degree)/180);
			rest2 += degree;
		}

		rest2 = 360 - rest2;
		sum2 += sin((M_PI*rest2)/180);

		if(fabs(sum1-sum2) < 0.00000001){
			printf("0\n");
		}else if(sum1 > sum2){
			printf("1\n");
		}else{
			printf("2\n");
		}
	}

    return 0;
}