#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  int n;
  while(cin>>n, n){
    int sum = 0;
    int ang;
    double s1 = 0.0, s2 = 0.0;
    REP(i,n-1){
      cin>>ang;
      sum += ang;
      s1 += sin(ang/180.0);
    }
    s1 += sin((360-sum)/180.0);

    int m;
    cin >> m;
    sum = 0;
    REP(i,m-1){
      cin>>ang;
      sum += ang;
      s2 += sin(ang/180.0);
    }
    s2 += sin((360-sum)/180.0);

    if(abs(s1-s2) < 1e-15) puts("0");
    else if(s1 > s2) puts("1");
    else puts("2");
  }
  return 0;
}