#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

double calcArea( vector<double> v ) {
  double sum = 0;
  
  for(int i=0; i<v.size(); i++) {
    sum += sin(v[i]/180*M_PI);
  }
  
  return sum;
}

int main() {

  int n;
  while(cin >> n, n) {
    vector<double> in;
    
    double sum = 0;
    for(int i=0; i<n-1; i++) {
      double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    in.push_back(360-sum);
    
    double A1 = calcArea(in);
    
    in.clear();
    int m;
    cin >> m;

    sum = 0;
    for(int i=0; i<m-1; i++) {
      double x;
      cin >> x;
      in.push_back(x);
      sum += x;
    }
    in.push_back(360-sum);
    
    double A2 = calcArea(in);
    
    if( A1 < A2 ) cout << 2 << endl;
    else if( A1 == A2 ) cout << 0 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}