#include<iostream>
#include<cmath>
using namespace std;
int main(){

  int m,n,v,m2,n2;
  double x,h,rad,S1,S2;
  
  while(1){
    
    cin >>m;
    
    if(m == 0)break;

    S1=0;
    S2=0;
    m2=360;
    n2=360;
    
    for(int i=0 ; i < m-1 ; i++){
      cin >>v;
      m2-=v;
      rad=v*(M_PI/180);
      x=sqrt(2-2*cos(rad));
      h=sqrt(1-(x*x/4));
      S1+=h*x/2;
    }
    
    rad=m2*(M_PI/180);
    x=sqrt(2-2*cos(rad));
    h=sqrt(1-(x*x/4));
    S1+=h*x/2;

    cin >>n;
    
    for(int i=0 ; i < n-1 ; i++){
      cin >>v;
      n2-=v;
      rad=v*(M_PI/180);
      x=sqrt(2-2*cos(rad));
      h=sqrt(1-(x*x/4));
      S2+=h*x/2;
    }

    rad=n2*(M_PI/180);
    x=sqrt(2-2*cos(rad));
    h=sqrt(1-(x*x/4));
    S2+=h*x/2;
    
    if( S1 == S2 ){
      cout <<"0"<<endl;
    }else if ( S1 > S2 ){
      cout <<"1"<<endl;
    }else{
      cout <<"2"<<endl;
    }

  }
      
  return 0;
}