#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int ScanningData(int&, vector<int>&);
double CalculateArea(vector<int>);

int main(){
  int i, m, n;
  vector<int> degree1, degree2;
  double result1, result2;

  while(1){
    if(ScanningData(m, degree1) == 0) break;
    if(ScanningData(n, degree2) == 0) break;

    result1 = CalculateArea(degree1);
    result2 = CalculateArea(degree2);

    if(result1 == result2)
      cout << "0" << endl;
    else if(result1 > result2)
      cout << "1" << endl;
    else
      cout << "2" << endl;

    degree1.clear();
    degree2.clear();
  }

  return 0;
}

int ScanningData(int& n, vector<int>& data){
  int i, x, sum=0;

  cin >> n;
  if(n == 0) return 0;

  for(i=0; i<n-1; ++i){
    cin >> x;
    sum += x;
    data.push_back(x);
  }

  data.push_back(360-sum);
  return 1;
}

double CalculateArea(vector<int> data){
  int i;
  double radian, s, sum=0;

  for(i=0; i<data.size(); ++i){
    radian = data[i] * M_PI / 180;
    s = sin(radian)/2;
    sum += s;
  }

  return sum;
}