#include <iostream>
#include <cmath>

using namespace std;

int main()
{
  int n;
  double r, s, t, a[2];
  bool f = false;

  while(1){
    a[0] = a[1] = 0;
    for(int j = 0; j <= 1; j++){
      cin >> n;
      if(n == 0){
	f = true;
	break;
      }
      s = 360.0;
      for(int i = 0; i < n-1; i++){
	cin >> r;
	s -= r;
	a[j] += cos(r/180.0*3.1415);
      }
      a[j] += cos(s/180.0*3.1415);
    }
    if(f){
      break;
    }
    if(a[0] == a[1]){
      t = 0;
    } else if(a[0] > a[1]){
      t = 1;
    } else {
      t = 2;
    }
    cout << t << endl;
  }


  return 0;
}