#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int M, N;

int main(){
  while(scanf("%d", &M) && M){
    double f = 0, s = 0;
    int r = 360;
    rep(i, M-1){
      int v;
      scanf("%d", &v);
      f += sin(v / 180.0 * M_PI);
      r -= v;
    }
    f += sin(r / 180.0 * M_PI);

    scanf("%d", &N);
    r = 360;
    rep(i, N-1){
      int v;
      scanf("%d", &v);
      s += sin(v / 180.0 * M_PI);
      r -= v;
    }
    s += sin(r / 180.0 * M_PI);

    if(abs(f-s) < EPS) puts("0");
    else if(f > s) puts("1");
    else puts("2");
  }
  return 0;
}