#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n;
  while(cin>>n,n){
    int a[400]={360};
    for(i=1;i<n;++i){
      cin>>a[i];
      a[0]-=a[i];
    }
    int m;
    cin>>m;
    int b[400]={360};
    for(i=1;i<m;++i){
      cin>>b[i];
      b[0]-=b[i];
    }
    double c=0,d=0;
    for(i=0;i<n;++i)
      c+=sin(M_PI*a[i]/180);
    for(i=0;i<m;++i)
      d+=sin(M_PI*b[i]/180);
    if(0){
    }else if(fabs(c-d)<1e-8){
      cout<<0<<endl;
    }else if(c<d){
      cout<<2<<endl;
    }else if(c>d){
      cout<<1<<endl;
    }
  }
  return 0;
}