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 <cmath>
#include <iostream>
using namespace std;

#define PI	3.1415926535
#define EPS	0.00000000001

int main()
{
	int n,a;
	int a1,a2;
	double h1,h2;
	while(cin >> n, n)
	{
		a1=a2=0;
		h1=h2=0;
		while(--n)
		{
			cin >> a;
			a1 += a;
			h1 += sin(a*PI/180.0);
		}
		cin >> n;
		while(--n)
		{
			cin >> a;
			a2 += a;
			h2 += sin(a*PI/180.0);
		}

		h1 += sin((360-a1)*PI/180.0);
		h2 += sin((360-a2)*PI/180.0);

		//if(-EPS<h1-h2 && h1-h2<EPS)
		if(h1==h2)
		{
			cout << 0 << endl;
		}
		else if(h1>h2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 2 << endl;
		}
	}

	return 0;
}

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

using namespace std;

const double PI = acos(-1);

int main(void){
  int n,m;
  double v;
  
  while(cin >> n,n){
    double sum1=0,sum2=0,s1=0,s2=0;
    while(--n){
      cin >> v;
      sum1+=v;
      s1+=abs(sin(v*PI/180));
    }
    s1+=abs(sin((360-sum1)*PI/180));
    cin >> m;
    while(--m){
      cin >> v;
      sum2+=v;
      s2+=abs(sin(v*PI/180));
    }
    s2+=abs(sin((360-sum2)*PI/180));
    int res= (s1==s2)?0:(s1>s2)?1:2;
    cout << res << endl;
  }

  return 0;
}

C++: #include <iostream>
#include<cmath>
 
using namespace std;
 
double EPS = 1e-10;
double pi = 3.1415926535;
 
double calc(int x) {
  return sin((double)x*pi/180.0);
}
  
 
int main(void){

  int n,m;
   
  while( cin >> n , n ){

    double s1 = 0, s2 = 0, angle, c = 360;
    
    for( int i = 0 ; i < n - 1 ; i++ ){
      cin >> angle;
      c -= angle;
      s1 += calc(angle);
    }
    s1 += calc(c);

    cin >> m;
    c = 360;

    for( int j = 0 ; j < m - 1 ; j++ ){
      cin >> angle;
      c -= angle;
      s2 += calc(angle);
    }
    s2 += calc(c);

    if( s1 > s2 + EPS ) cout << 1 << endl;
    else if( s1 + EPS < s2 ) cout << 2 << endl;
    else cout << 0 << endl;
  }
 
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

const double Eps = 1e-8;
const double PI = 4*atan(1.0);

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		double area[2];
		area[0] = area[1] = 0;
		for (int w = 0; w < 2; ++w)
		{
			for (int i = 1; i < n; ++i)
			{
				int v;
				scanf("%d", &v);
				area[w] += sin(v*PI / 180);
			}
			if (!w)
				scanf("%d", &n);
		}
		if (area[0] == area[1])
			puts("0");
		else if (area[0] > area[1])
			puts("1");
		else
			puts("2");
	}

	return 0;
}

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

using namespace std;

#define PI 3.1415926535

int main() {
	int n, m;
	while(cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 360;
		int a;
		long double men1 = 0.0;
		for (int i = 0; i < n-1; i++) {
			cin >> a;
			men1 += 0.5*1.0*1.0*(long double)sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men1 += 0.5*1.0*1.0*(long double)sin(((double)a/360.0)*PI*2.0);
		cin >> m;
		counter = 360;
		long double men2 = 0.0;
		for (int i = 0; i < m-1; i++) {
			cin >> a;
			men2 += 0.5*1.0*1.0*(long double)sin(((double)a/360.0)*PI*2.0);
			counter -= a;
		}
		men2 += 0.5*1.0*1.0*(long double)sin(((double)a/360.0)*PI*2.0);
		if (men1 == men2) {
			cout << 0 << endl;
		} else if (men1 > men2){
			cout << 1 << endl;
		} else {
			cout << 2 << endl;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

const double Eps = 1e-9;
const double PI = 4*atan(1.0);

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		double area[2];
		area[0] = area[1] = 0;
		for (int w = 0; w < 2; ++w)
		{
			int s = 0;
			for (int i = 1; i < n; ++i)
			{
				int v;
				scanf("%d", &v);
				s += v;
				area[w] += sin(v*PI/180);
			}
			area[w] += sin((360-s)*PI/180);
			if (!w)
				scanf("%d", &n);
		}
		if (abs(area[0] - area[1]) < Eps)
			puts("0");
		else if (area[0] > area[1])
			puts("1");
		else
			puts("2");
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-12;
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    double m1,m2;
    int m=360;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m-=tmp;
      m1+=sin(PI*tmp/180.0);
    }
    m1+=sin(PI*m/180.0);
    cin>>n;
    m=360;
    rep(i,n-1){
      int tmp;
      cin>>tmp;
      m-=tmp;
      m2+=sin(PI*tmp/180.0);
    }
    m2+=sin(PI*m/180.0);
    if(abs(m1-m2)<ESP)cout<<0<<endl;
    else if(m1>m2)cout<<1<<endl;
    else cout<<2<<endl;
  }

}

C++: #include <complex>
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <sstream>

class Point {
public:
	Point();
	Point(int x_in, int y_in);

	Point  operator+(const Point& obj);
	Point  operator-(const Point& obj);
	Point  operator*(const double n);
	Point  operator/(const double n);

	void set(int x_in, int y_in);

	double x;
	double y;
};

Point::Point() {
	x = 0;
	y = 0;
}

Point::Point(int x_in, int y_in) {
	x = x_in;
	y = y_in;
}

Point Point::operator+(const Point& obj) {
	Point temp;
	temp.x = x + obj.x;
	temp.y = y + obj.y;
	return temp;
}

Point Point::operator-(const Point& obj) {
	Point temp;
	temp.x = x - obj.x;
	temp.y = y - obj.y;
	return temp;
}

Point Point::operator*(const double n) {
	Point temp;
	temp.x = x * n;
	temp.y = y * n;
	return temp;
}

Point Point::operator/(const double n) {
	Point temp;
	temp.x = x / n;
	temp.y = y / n;
	return temp;
}

void Point::set(int x_in, int y_in) {
	x = x_in;
	y = y_in;
}

double abs(Point point) {
	return sqrt(point.x * point.x + point.y * point.y);
}

int N;
Point V[50];

std::string solve() {
	if (N % 2 != 0) return "NA";
	Point center = (V[0] + V[N / 2]) / 2;
	for (int i = 1; i < N / 2; i++) {
		Point median = (V[i] + V[i + N / 2]) / 2;
		Point dist = center - median;
		if (abs(dist) >= 0.001) {
			return "NA";
		}
	}
	std::ostringstream str;
	str << center.x << " " << center.y;
	return str.str();
}

int main() {
	//入力
	std::cin >> N;
	int x, y;
	for (int i = 0; i < N; i++) {
		std::cin >> x >> y;
		V[i].set(x, y);
	}
	//演算
	std::string answer = solve();
	//出力
	std::cout << answer << std::endl;
	return 0;
}