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++: /**************** Geometrical Library ****************/

#include<cmath>
#include<vector>
#include<algorithm>

#define	EPS	1e-8

enum {CCW=1,CW=-1,ON=0};

#define	mp	make_pair
#define	pb	push_back

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy):x(xx),y(yy){}
};

class Line:public vector<Point>{
public:
	Line(const Point &a,const Point &b){
		pb(a),pb(b);
	}
};

class Segment:public Line{
public:
	Segment(const Point &a,const Point &b):Line(a,b){}
};

class Polygon:public vector<Point>{};

class Circle{
public:
	Point c;
	double r;
	Circle(const Point &cc,double rr) : c(cc),r(rr){}
};

Point &operator +=(Point &a,const Point &b){
	a.x+=b.x,a.y+=b.y;
	return a;
}

Point &operator -=(Point &a,const Point &b){
	a.x-=b.x,a.y-=b.y;
	return a;
}

Point &operator *=(Point &a,double c){
	a.x*=c,a.y*=c;
	return a;
}

Point &operator /=(Point &a,double c){
	a.x/=c,a.y/=c;
	return a;
}

Point operator +(const Point &a,const Point &b){
	Point c=a;
	return c+=b;
}

Point operator -(const Point &a,const Point &b){
	Point c=a;
	return c-=b;
}

Point operator *(double c,const Point &a){
	Point b=a;
	return b*=c;
}

Point operator /(const Point &a,double c){
	Point b=a;
	return b/=c;
}

bool operator <(const Point &a,const Point &b){
	return (a.x==b.x)?(a.y<b.y):(a.x<b.x);
}

bool operator >(const Point &a,const Point &b){
	return b<a;
}

double cross(const Point &a,const Point &b){
	return a.x*b.y-a.y*b.x;
}

double area(const Polygon &pl){
	int n=pl.size();
	double a=0;
	for(int i=0;i<n;i++)	a+=cross(pl[i],pl[(i+1)%n]);
	return abs(a)/2;
}

/**************** Library END ****************/

#include<cstdio>

int main(){
	const double R=1000;
	for(int m;scanf("%d",&m),m;){
		Polygon pl1;	pl1.pb(Point(R,0));
		for(int i=1;i<m;i++){
			int v;	scanf("%d",&v);
			pl1.pb(Point(R*cos(2*M_PI*v/180),R*sin(2*M_PI*v/180)));
		}
		int n;	scanf("%d",&n);
		Polygon pl2;	pl2.pb(Point(R,0));
		for(int i=1;i<n;i++){
			int v;	scanf("%d",&v);
			pl2.pb(Point(R*cos(2*M_PI*v/180),R*sin(2*M_PI*v/180)));
		}
		double a1=area(pl1),a2=area(pl2);
		if(a1>a2+EPS)		puts("1");
		else if(a2>a1+EPS)	puts("2");
		else	puts("0");
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define EPS (1e-10)
#define PI 3.14159265358979323846264
using namespace std;
 
double rad(double d)
{
  return d*(PI/180.0);
}

int main()
{
  int m;
  while(cin >> m,m)
    {
      double v,areaA,areaB;
      areaA = areaB = 0;
      double ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaA += sin(rad(v));
	  ano -= v;
	}
      areaA += sin(rad(ano));
 
      cin >> m;
      ano = 360;
      for(int i=0;i<m-1;i++)
	{
	  cin >> v;
	  areaB += sin(rad(v));
	  ano -= v;
	}
      areaB += sin(rad(ano));
            

      if(fabs(areaA-areaB) <= EPS)
	cout << 0 << endl;
      else if(areaA > areaB)
	cout << 1 << endl;
      else 
	cout << 2 << endl;
      
    }
  return 0;
}

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

#define eps 1.0e-8
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);
    }
    s1 += sin(dd * M_PI/180.0);
    cin>>n;
    dd = 360.0;
    for (i = 1; i < n; i++) {
      cin>>d;
      dd -= d;
      s2 += sin(d * M_PI/180.0);
    }
    s2 += sin(dd * M_PI/180.0);
    if (fabs(s1-s2) < eps) f = 0;
    else if (s1>s2) f = 1;
    else f = 2;
    cout<<f<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int m;
  while(cin>>m){
    if(m==0) break;
    double s1=0,s2=0;
    int t1=0,t2=0;
    REP(i,m-1){
      int t;
      cin>>t;
      s1 += sin((double)t*M_PI/180);
      t1 += t;
    }
    s1+=sin((double)(360-t1)*M_PI/180);
    cin>>m;
    REP(i,m-1){
      int t;
      cin>>t;
      s2 += sin((double)t*M_PI/180);
      t2 += t;
    }
    s2 += sin((double)(360-t2)*M_PI/180);
    if(abs(s1-s2)<EPS){
      cout<<0<<endl;
    }else if(s1>s2){
      cout<<1<<endl;
    }else if(s2>s1){
      cout<<2<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>

typedef long double ld;

int main()
{
	int m, n;
	while (true) {
		std::cin >> m;
		if (m==0) break;
		int deg_total = 0;
		ld area1 = 0.0;
		for (int i=0; i<m-1; i++) {
			int d; std::cin >> d;
			deg_total += d;
			area1 += std::sin((ld)d * M_PI / 180.0);
		}
		area1 += std::sin((ld)(360-deg_total) * M_PI / 180.0);
		std::cin >> n;
		deg_total = 0;
		ld area2 = 0.0;
		for (int i=0; i<n-1; i++) {
			int d; std::cin >> d;
			deg_total += d;
			area2 += std::sin((ld)d * M_PI / 180.0);
		}
		area2 += std::sin((ld)(360-deg_total) * M_PI / 180.0);
		if (area1 > area2) std::cout << 1 << std::endl;
		else if (area1 < area2) std::cout << 2 << std::endl;
		else std::cout << 0 << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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 INF 1<<30

double dtor(double deg) {       // x¨WA
  return deg*M_PI/180;
}

int main() {
  int m;
  while(cin >> m, m) {
    m--;
    int v1[m];
    REP(i,m)
      cin >> v1[i];
    int n;
    cin >> n;
    n--;
    int v2[n];
    REP(i,n)
      cin >> v2[i];

    double s1 = 0;
    double s2 = 0;
    REP(i,m) 
      s1 += sin(dtor(v1[i]));
    REP(i,n)
      s2 += sin(dtor(v2[i]));
    if (abs(s1-s2)<1e-10)
      cout << 0;
    else if (s1>s2)
      cout << 1;
    else
      cout << 2;
    cout << endl;
  }
}