#include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define min 0.000001
using namespace std;

int main(){
  while(1){
    int m;
    cin>>m;
    if(!m)break;
    double Asum=0;
    double cnt;
    int sum=0;
    rep(i,m-1){
      cin>>cnt;
      Asum+=sin(cnt*M_PI/180.0)/2;
      sum+=cnt;
    }
    Asum+=sin((360-sum)*M_PI/180.0)/2;
    double Bsum=0;
    int n;
    cin>>n;
    sum=0;
    rep(i,n-1){
      cin>>cnt;
      Bsum+=sin(cnt*M_PI/180.0)/2;
      sum+=cnt;
    }
    Bsum+=sin((360-sum)*M_PI/180.0)/2;
    double rest=abs(Asum-Bsum);
    if(rest<min)cout<<0<<endl;
    if(rest>=min && Asum>Bsum)cout<<1<<endl;
    else if(rest>=min && Bsum>Asum)cout<<2<<endl;
  }
  return 0;
}