#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-8;

int main() {
  for(int tci = 0; ; tci++) {
    double result[2];
    for(int ii = 0; ii < 2; ii++) {
      int m; scanf("%d", &m); if(m==0) goto done;
      int rdegree = 360;
      double area = 0.0;
      for(int i = 1; i < m; i++) {
        int d; scanf("%d", &d);
        area += sin(M_PI*d/180);
        rdegree -= d;
      }
      area += sin(M_PI*rdegree/180);
      result[ii] = area;
    }
    if(result[0]-result[1]>EPS)
      printf("1\n");
    else if(result[1]-result[0]>EPS)
      printf("2\n");
    else
      printf("0\n");
  }
done:
  return 0;
}