// テ」ツつ「テ」ツつォテ」ツつヲテ」ツδウテ」ツδ暗ゥツ鳴禿ゥツ?陛」ツ?暗」ツ?淌・ツ按?」ツ?ョテ」ツδ堙」ツδ甘」ツδォテ」ツδ?」ツつ」ireta
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

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

int main() {

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

    in.clear();
    int m;
    cin >> m;

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