#include<cmath>
#include<iostream>
using namespace std;
int n,m;
int N[500],M[500];
double Sn[500],Sm[500],sumN,sumM,sum;
double pi = acos(-1.0);

double d2r(int d){
  return 2.0*pi*((double)d/360.0);
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    sum=0;
    sumM=sumN=0.0;
    for(int i=0;i<n-1;i++){
      cin>>N[i];
      sumN+= 1.0 * 1.0 * sin( d2r(N[i])  );
    }
    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>M[i];
      sumM+= 1.0 * 1.0 * sin( d2r(M[i])  );
    }
    sum=sumM-sumN;
    if(sum<0.0)sum*=-1.0;
    if(sum<0.00001){
      cout<<0<<endl;
    }else if(sumM<sumN){
      cout<<1<<endl;
    }else{
      cout<<2<<endl;
    }
  }
  return 0;
}