#include<iostream>
#include<cmath>

using namespace std;

const double PI = acos(-1);

int main(void){
  int n,m;
  double v;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0;
    while(--n){
      cin >> v;
      sum1+=v;
      s1+=abs(sin(v));
    }
    s1+=abs(sin(360-sum1));
    cin >> m;
    while(--m){
      cin >> v;
      sum2+=v;
      s2+=abs(sin(v));
    }
    s2+=abs(sin(360-sum2));
    int res= (s1==s2)?0:(s1>s2)?1:2;
    cout << res << endl;
  }

  return 0;
}