Go: package main

import (
	"bufio"
		"os"
	"strconv"
	"math"
	"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		m, _ := strconv.Atoi(scanner.Text())
		if m == 0 {
			break
		}
		args1 := make([]float64, m)
		x := 0.0
		for i := 0; i < m-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			x += tmp
			args1[i] = tmp
		}
		args1[m-1] = 360-x
		first_object := 0.0
		for _, v := range args1 {
			first_object+= math.Abs(math.Sin(v))
		}
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		args2 := make([]float64, n)
		y := 0.0
		for i := 0; i < n-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			y += tmp
			args2[i] = tmp
		}
		args2[n-1] = 360-y
		second_object := 0.0
		for _, v := range args2 {
			second_object+= math.Abs(math.Sin(v))
		}
		if first_object < second_object {
			fmt.Println(2)
		} else if first_object == second_object {
			fmt.Println(0)
		} else if first_object > second_object {
			fmt.Println(1)
		}
	}
}

C++: 
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
  int n, i, f;
  double d, dd, s1, s2;
  while (cin>>n, n) {
    s1 = s2 = 0;
    dd = 360.0;
    for (i = 1; i < n; i++) {
      cin>>d;
      dd -= d;
      s1 += sin(d * M_PI/180.0)/2.0;
    }
    s1 += sin(dd * M_PI/180.0)/2.0;
    cin>>n;
    dd = 360.0;
    for (i = 1; i < n; i++) {
      cin>>d;
      dd -= d;
      s2 += sin(d * M_PI/180.0)/2.0;
    }
    s2 += sin(dd * M_PI/180.0)/2.0;
    if (s1>s2) f = 1;
    else if (s1==s2) f = 0;
    else f = 2;
    cout<<f<<endl;
  }
  return 0;
}

C++: #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>
using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define REP(i, s, e) for ( int i = s; i <= e; i++ )  

const double INF = 1e12;
typedef complex<double> P,point;
typedef vector<P> G,polygon;
namespace std {bool operator < (const P& a, const P& b) {return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);}}
double cross(const P& a, const P& b) {return imag(conj(a)*b);}
double dot(const P& a, const P& b) {return real(conj(a)*b);}
struct L : public vector<P> {L(const P &a, const P &b) {push_back(a); push_back(b);}};
struct C {P p; double r;C(const P &p, double r) : p(p), r(r) { }};
int ccw(P a, P b, P c) {b -= a; c -= a;if (cross(b, c) > 0)   return +1;if (cross(b, c) < 0)   return -1;if (dot(b, c) < 0) return +2;if (norm(b) < norm(c)) return -2;return 0;}

// Check Funcs //
bool intersectLL(const L &l, const L &m) {return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;}
bool intersectLS(const L &l, const L &s) {return cross(l[1]-l[0], s[0]-l[0])*cross(l[1]-l[0], s[1]-l[0]) < EPS;}
bool intersectLP(const L &l, const P &p) {return abs(cross(l[1]-p, l[0]-p)) < EPS;}
bool intersectSS(const L &s, const L &t) {return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 && ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;}
bool intersectSP(const L &s, const P &p) {return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS;}

// Where is Point in Polygon? //
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
enum { OUT, ON, IN };
int contains(const polygon& P, const point& p) {bool in = false;for (int i = 0; i < P.size(); ++i) {point a = curr(P,i) - p, b = next(P,i) - p;if (imag(a) > imag(b)) swap(a, b);if (imag(a) <= 0 && 0 < imag(b))if (cross(a, b) < 0) in = !in;if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;}return in ? IN : OUT;}
// Area of Polygon //
double area2(const polygon& P) {double A = 0;for (int i = 0; i < P.size(); ++i)A += cross(curr(P, i), next(P, i));return A;}
// Totsuhou! Andrew's Monotone Chain //
vector<point> convex_hull(vector<point> ps) {int n = ps.size(), k = 0;sort(ps.begin(), ps.end());vector<point> ch(2*n);for (int i = 0; i < n; ch[k++] = ps[i++])while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--])while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;ch.resize(k-1);return ch;}

P projection(const L &l, const P &p) {double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);return l[0] + t*(l[0]-l[1]);}
P reflection(const L &l, const P &p) {return p + 2.0 * (projection(l, p) - p);}
double distanceLP(const L &l, const P &p) {return abs(p - projection(l, p));}
double distanceLL(const L &l, const L &m) {return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);}
double distanceLS(const L &l, const L &s) {if (intersectLS(l, s)) return 0;return min(distanceLP(l, s[0]), distanceLP(l, s[1]));}
double distanceSP(const L &s, const P &p) {const P r = projection(s, p);if (intersectSP(s, r)) return abs(r - p);return min(abs(s[0] - p), abs(s[1] - p));}
double distanceSS(const L &s, const L &t) {if (intersectSS(s, t)) return 0;  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),min(distanceSP(t, s[0]), distanceSP(t, s[1])));}
P crosspoint(const L &l, const L &m) {double A = cross(l[1] - l[0], m[1] - m[0]);double B = cross(l[1] - l[0], l[1] - m[0]);if (abs(A) < EPS && abs(B) < EPS) return m[0];return m[0] + B / A * (m[1] - m[0]);}


static const double PI = 6*asin( 0.5 );

double toRad(double theta){
	return theta * (PI/180.0);
}


double getArea(P a, P b , P c){
		b-=a, c-=a;
		return fabs( b.real() * c.imag() - c.real() * b.imag() ) / 2.0; 
}

double getPolyArea(vector<P> &v){
	P tg = v[0];
	double ret = 0;
	for(int i=1;i<v.size()-1;i++){
		ret += getArea(v[i],v[i+1],tg);
	}
	return ret;
}

int main(){
	int m;
	while(cin >> m , m){
		vector<P> one,two;
		double cur = 0;
		rep(i,m-1){
			one.push_back(P(cos(cur),sin(cur)));
			double a;cin >> a;
			cur += toRad(a);
		}
		cur = 0;int n; cin >> n;
		rep(i,n-1){
			two.push_back(P(cos(cur),sin(cur)));
			double a;cin >> a;
			cur += toRad(a);
		}
		double s1 = getPolyArea(one) , s2 = getPolyArea(two);
		if(abs(s1-s2) < EPS){
			cout << 0 << endl;
		}else if(s1 > s2){
			cout << 1 << endl;
		}else{
			cout << 2 << endl;
		}
	}
}