#include<iostream>
#include<cmath>
using namespace std;
int n,m,T,U;
int t[1000],u[1000];
double at,au;
double EPS=0.000000001;
double calc_area(double);

bool eq(double x,double y){return (-EPS<x-y&&x-y<EPS);}
int main(){
  while(cin>>n&&n!=0){
    at=au=0.0;
    T=U=360;
    for(int i=0;i<n-1;i++){
      cin>>t[i];
      T-=t[i];
      at+=calc_area((double)t[i]*M_PI/180.0);
    }
    at+=calc_area((double)T*M_PI/180.0);

    cin>>m;
    for(int i=0;i<m-1;i++){
      cin>>u[i];
      U-=u[i];
      au+=calc_area((double)u[i]*M_PI/180.0);
    }
    au+=calc_area((double)U*M_PI/180.0);

    if(eq(au,at))cout<<"0"<<endl;
    else if(au<at)cout<<"1"<<endl;
    else cout<<"2"<<endl;
    
  }
  return 0;
}

double calc_area(double x){
  return sin(x);
}