//02
#include<iostream>
#include<cmath>

using namespace std;

int main(){
  for(int m;cin>>m,m;){
    int mr=360;
    double ms=0;
    for(int i=0;i<m-1;i++){
      int a;
      cin>>a;
      mr-=a;
      ms+=sin(acos(-1)*a/180);
    }
    ms+=sin(acos(-1)*mr/180);
    int nr=360;
    double ns=0;
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
      int a;
      cin>>a;
      nr-=a;
      ns+=sin(acos(-1)*a/180);
    }
    ns+=sin(acos(-1)*nr/180);
    int ans;
    if(ms>ns){
      ans=1;
    }else if(ms<ns){
      ans=2;
    }else{
      ans=0;
    }
    cout<<ans<<endl;
  }
  return 0;
}
    