#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#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()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second

int dx[]={0,1,0,-1},dy[]={1,0,-1,0};


main(){
  int m;
  while(cin>>m,m){
    int v=0;
    double s1=0;
    rep(i,m-1){
      int tv;
      cin>>tv;
      v+=tv;
      s1+=sin(M_PI/180*tv);
    }
    s1+=sin(M_PI/180*(360-v));
    v=0;
    cin>>m;
    rep(i,m-1){
      int tv;
      cin>>tv;
      v+=tv;
      s1-=sin(M_PI/180*tv);
    }
    s1-=sin(M_PI/180*(360-v));
    if(abs(s1)<EPS)cout<<0<<endl;
    else if(s1<0)cout<<2<<endl;
    else cout<<1<<endl;
  }
}