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.Sin(v*math.Pi/180)
		}
		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.Sin(v*math.Pi/180)
		}
		if first_object > second_object+ 0.0000001 {
			fmt.Println(1)
		} else if second_object > first_object +0.0000001 {
			fmt.Println(2)
		} else {
			fmt.Println(0)
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

const int EPS = 1e-8;

int main(){
	while(true){
		int N[2], V, V_;
		double S[2] = {};
		for(int i = 0; i < 2; i++){
			cin >> N[i];
			if(N[i] == 0) return 0;
			V_ = 360;
			for(int j = 0; j < N[i]-1; j++){
				cin >> V;
				V_ -= V;
				S[i] += sin(M_PI*V/180);
			}
			S[i] += sin(M_PI*V_/180);
		}
		if(S[0] - S[1] > EPS) puts("1");
		if(S[1] - S[0] > EPS) puts("2");
		else puts("0");
	}
	return 0;
}

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

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

double get_area(const vector<double> vs) {
	double ang = 0, res = 0;
	for (auto v : vs) {
		ang += v;
		res += sin(M_PI * v / 180.);
	}
	res += sin(M_PI * (360 - ang) / 180.);
	return res;
}

int main() {
	int m;
	while (cin >> m, m) {
		vector<double> vs1(m - 1);
		for (auto& v : vs1) cin >> v;
		cin >> m;
		vector<double> vs2(m - 1);
		for (auto& v : vs2) cin >> v;

		double a = get_area(vs1);
		double b = get_area(vs2);
		if (eq(a, b)) cout << 0 << endl;
		if (a < b) cout << 1 << endl;
		else if (a > b) cout << 2 << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

const int EPS = 1e-8;

int main(){
	while(true){
		int N[2], V, V_;
		double S[2] = {};
		for(int i = 0; i < 2; i++){
			cin >> N[i];
			if(N[i] == 0) return 0;
			V_ = 360;
			for(int j = 0; j < N[i]-1; j++){
				cin >> V;
				V_ -= V;
				S[i] += sin(M_PI*V/180);
			}
			S[i] += sin(M_PI*V_/180);
		}
		if(S[0] - S[1] > EPS) puts("1");
		else if(S[1] - S[0] > EPS) puts("2");
		else puts("0");
	}
	return 0;
}

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

using namespace std;


int main(void){
  int n,m;
  
  while(cin >> n,n){
    int sum1=0,sum2=0;
    double s1=0,s2=0;
   
    for(int i=0;i<n-1;i++){
      int v;
      cin >> v;
      sum1+=v;
      s1+=sin((double)(v*M_PI)/180);
    }
    s1+=sin((double)((360-sum1)*M_PI)/180);
    cin >> m;
    for(int j=0;j<m-1;j++){
      int v;
      cin >> v;
      sum2+=v;
      s2+=sin((double)(v*M_PI)/180);
    }
    s2+=sin((double)((360-sum2)*M_PI)/180);
    if(s1>s2) cout << 1 << endl;
    else if(s1<s2) cout << 2 << endl;
    else cout << 0 << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<utility>
#include<cmath>
using namespace std;
#define all(a) a.begin(),a.end()
double calc(double a,double b,double c)
{
	double s=(a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
	int m,n;
	
	while(cin>>m&&m)
	{
		double a=0,b=0;
		double r=360;
		for(int i=0;i<m-1;i++)
		{
			double v;cin>>v;
			r-=v;
			a+=calc(sin(v/2)*2,1,1);
		}
		a+=calc(sin(r/2)*2,1,1);
		cin>>n;
		r=360;
		for(int i=0;i<n-1;i++)
		{
			double v;cin>>v;
			r-=v;
			b+=calc(sin(v/2)*2,1,1);
		}
		b+=calc(sin(r/2)*2,1,1);
		if(fabs(a-b)<1e-8)cout<<0<<endl;
		else if(a>b)cout<<1<<endl;
		else cout<<2<<endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

const double PI = 3.1415926;

int main() {
	int m, n, degree, rest;
	double sum1, sum2;

	while (cin >> m, m) {
		sum1 = rest = 0;
		for (int i = 1; i < m; i++) {
			cin >> degree;
			rest += degree;
			sum1 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum1 += sin(degree*PI / 180.0);
		//cout << "sum1="<<sum1 << endl;

		cin >> n;
		sum2 = rest = 0;
		for (int i = 1; i < n; i++) {
			cin >> degree;
			rest += degree;
			sum2 += sin(degree*PI / 180.0);
		}
		degree = 360 - rest;
		sum2 += sin(degree*PI / 180.0);
		//cout << "sum2"<<sum2 << endl;

		if (fabs(sum1 - sum2) < 1e-10) {
			cout << "0" << endl;
		}
		else if (sum1 < sum2) {
			cout << "2" << endl;
		}
		else {
			cout << "1" << endl;
		}
	}

	return 0;
}

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

double abs(double d){
	return (d>0)?d:-d;
}

int main(){
	int m, n;
	while(std::cin >> m, m){
		double Sm = 0, Sn = 0;
		int remained_angle = 360;

		for(int i=0;i<m-1;i++){
			int angle;
			std::cin >> angle;
			Sm += sin(1.0 * angle * M_PI / 180);
			remained_angle -= angle;
		}
		Sm += sin(1.0 * remained_angle * M_PI / 180);

		remained_angle = 360;
		std::cin >> n;
		for(int i=0;i<n-1;i++){
			int angle;
			std::cin >> angle;
			Sn += sin(1.0 * angle * M_PI / 180);
			remained_angle -= angle;
		}
		Sn += sin(1.0 * remained_angle * M_PI / 180);

		if(abs(Sm - Sn) < 1e-8){
			puts("0");
		}else if(Sm > Sn){
			puts("1");
		}else{
			puts("2");
		}
	}
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


double getArea( double ang ) {
    double rad = ang / 180.0 * M_PI;
    return sin( rad );
}

double calc( VI v ) {
    double res = 0.0;
    int n = v.size();
    for ( int i = 0; i < n; ++ i ) {
        res += getArea( v[i] );
    }
    return res;
}

int solve( double s1, double s2 ) {
    if ( fabs( s1 - s2 ) < 1e-9 ) return 0;
    return s1 < s2 ? 2 : 1;
}

int main() {
    int m;
    while ( cin >> m && m ) {
        VI v1(m-1);
        for ( int i = 0; i < m-1; ++ i ) {
            cin >> v1[i];
        }
        int n;
        cin >> n;
        VI v2(n-1);
        for ( int i = 0; i < n-1; ++ i ) {
            cin >> v2[i];
        }
        double s1 = calc( v1 );
        double s2 = calc( v2 );
        cout << solve( s1, s2 ) << endl;
    }
    return 0;
}