#include<iostream>
#include<cmath>
#include<cstdio>

double abs(double d){
	return (d>0)?d:-d;
}

int main(){
	int m, n;
	while(std::cin >> m, m){
		double Sm = 0, Sn = 0;
		int remained_angle = 360;

		for(int i=0;i<m-1;i++){
			int angle;
			std::cin >> angle;
			Sm += sin(1.0 * angle * M_PI / 180);
			remained_angle -= angle;
		}
		Sm += sin(1.0 * remained_angle * M_PI / 180);

		remained_angle = 360;
		std::cin >> n;
		for(int i=0;i<n-1;i++){
			int angle;
			std::cin >> angle;
			Sn += sin(1.0 * angle * M_PI / 180);
			remained_angle -= angle;
		}
		Sn += sin(1.0 * remained_angle * M_PI / 180);

		if(abs(Sm - Sn) < 1e-8){
			puts("0");
		}else if(Sm > Sn){
			puts("1");
		}else{
			puts("2");
		}
	}
}