#include<cmath>
#include<iostream>
using namespace std;
int n,m,o;
int N,M;
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(){
  //cout<<d2r(270)/pi<<endl;
  while(1){
    cin>>n;
    if(n==0)break;
    sumM=sumN=0.0;

    o=0;
    for(int i=0;i<n-1;i++){
      cin>>N;
      o+=N;
      if(N>=180)continue;
      sumN += 1.0 * 1.0 * sin( d2r(N)  ) * 0.5;
    }
    sumN += 1.0 * 1.0 * sin( d2r(360-o)  ) * 0.5;
    
    o=0;
    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>M;
      o+=M;
      if(M>=180)continue;
      sumM += 1.0 * 1.0 * sin( d2r(M)  ) * 0.5;
    }
    sumM += 1.0 * 1.0 * sin( d2r(360-o)  ) * 0.5;

    sum=sumM-sumN;
    if(sum<0.0)sum*=-1.0;
    if(sum<0.0000001){
      cout<<0<<endl;
    }else if(sumM<sumN){
      cout<<1<<endl;
    }else{
      cout<<2<<endl;
    }
  }
  return 0;
}