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;

#define IPS 1e-10

double area(int deg) {
    return sin((double)deg / 180 * M_PI);
}

int main() {
    int m, n;
    while (cin >> m, m) {
        int deg, remain = 360;
        double a1 = 0, a2 = 0;
        while (--m) {
            cin >> deg;
            remain -= deg;
            a1 += area(deg);
        }
        a1 += area(remain);

        remain = 360;
        cin >> n;
        while (--n) {
            cin >> deg;
            remain -= deg;
            a2 += area(deg);
        }
        a2 += area(remain);

        if (abs(a1-a2) < IPS) {
            cout << "0" << endl;
        }
        else if (a1 > a2) {
            cout << "1" << endl;
        }
        else {
            cout << "2" << endl;
        }

    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define pi 4*atan(1.0)
#define rep(i,n) for(int i=0;i<n;i++)

int m,n;
double v;

int main(){
	while(cin>>m&&m){
		double sum=0,area=0;
		rep(i,m-1){
			cin>>v;
			sum+=v;
			area+=sin(v*pi/180.0);
		}
		area+=sin((360.0-sum)*pi/180.0);
		double area2=0;sum=0;
		cin>>n;
		rep(i,n-1){
			cin>>v;
			sum+=v;
			area2+=sin(v*pi/180.0);
		}
		area2+=sin((360.0-sum)*pi/180.0);
		if(abs(area-area2)<EPS)cout<<0<<endl;
		else cout<<(area>area2?1:2)<<endl;
	}
}