Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>a
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

const double EPS = 0.000000001;

int main(){
	
	int a,b;
	double angle = M_PI/2;
	P pos = P(0,0);
	
	while(scanf("%d,%d",&a,&b)){
		if(a==0 && b==0)break;
		pos += P(cos(angle),sin(angle))*(double)a;
		angle -= b/180.0*M_PI;
	}
	
	printf("%d %d\n",int(pos.X-0.5+EPS),int(pos.Y-0.5+EPS));
}

C++: #include<iostream>
#include<math.h>
using namespace std;

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=90;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos(prad*pi/180);
		dy=d*sin(prad*pi/180);
		x+=dx;
		y+=dy;
		prad=prad-rad;
	//	cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	//while(1);
	return 0;
}

C++: #include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cstdio>
using namespace std;

int main(){
	
	double x=0,y=0;
	int r=90;
	int a,b;
	char cn;
	while(cin>>a>>cn>>b){
	if(a!=b!=0){
		double s=r*M_PI/180;
		x-=a*cos(s);
		y+=a*sin(s);
		if(r+b<0)
			r=360-r-b;
		else if(r+b>360)
			r=r+b-360;
		else
			r=r+b;
	}
	else
		break;
	}
	printf("%d\n%d\n",(int)x,(int)y);
		
	
}

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

using namespace std;

static const double PI = 3.141592;

int main()
{
    int m,r,dr;
    double x = 0.0, y = 0.0;
    r = 0;
    while(scanf("%d,%d", &m, &dr) == 2 && (m != 0 || dr != 0)) {
        double dx = (m * cos(r * PI / 180.0)), dy = (m * sin(r * PI / 180.0));
        x += dx; y += dy;
        r = (r + dr + 360) % 360;
    }
    cout << (int)y << endl;
    cout << (int)x << endl;
}

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

using namespace std;

int main() {
	const double Pi = 3.14159265358979323846;
	// 初期値は北なので、９０度
	int angle = 90;
	double x = 0, y = 0;
	while (true) {
		// r:距離 a回転角
		int r, a;

		cin >> r;
		cin.ignore();
		cin	>> a;
		if (r == 0 && a == 0) {
			break;
		}

		double dx = r * cos(angle / 180.0 * Pi);
		double dy = r * sin(angle / 180.0 * Pi);

		x += dx;
		y += dy;

		angle -= a;
		if (angle >= 360) {
			angle %= 360;
		}
		else if (angle < 0) {
			angle += 360;
		}

	}
	cout << static_cast<int>(x) << endl << static_cast<int>(y) << endl;
}

C++: #include <iostream>
#include <math.h>
#include <stdlib>
using namespace std;
#define PI 3.14159265
int main()
{
    double x=0,y=0;
	int r,dth,th=0;
	while(true){
		scanf("%d,%d",&r,&dth);
		if(!r&&!dth)break;
		x+=r*sin((double)th*PI/180);
		y+=r*cos((double)th*PI/180);
		th+=dth;
	}
	cout<<int(x)<<endl;
	cout<<int(y)<<endl;
    return 0;
}

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

using namespace std;

int main()
{
	double x = 0, y = 0;
	int hosuu, kakudo;
	char tmp;
	int theta = 90;

	while ( 1 )
	{
 		cin >> hosuu >> tmp >> kakudo;
		if ( hosuu == 0 && kakudo == 0 )
		{
			break;
		}

		y = y + hosuu * sin( theta * M_PI / 180 );
		x = x + hosuu * cos( theta * M_PI / 180 );

		theta = theta - kakudo;
	}

	cout << ( int )x << endl;
	cout << ( int )y << endl;

	return 0;
}

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


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r;
	while (d != 0 || r != 0) {
		cin >> d >> r;
		x = x + d * cos(a / 2 / pi);
		y = y + d * sin(a / 2 / pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}

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

int main()
{
    char comma;
    double x = 0, y = 0, env = 0;
    for (double d, t; cin >> d >> comma >> t && (d || t);) {
        x += sin(env) * d;
        y += cos(env) * d;
        env += t * M_PI / 180;
    }
    cout << (int) x << endl;
    cout << (int) y << endl;

    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n, t, a = 90;
	char c;
	double x = 0.0, y = 0.0;
	while (cin >> n >> c >> t, n || t)
	{
		x += n * cos((double)a*3.14159265/180);
		y += n * sin((double)a*3.14159265/180);
		a -= t;
	}
	cout << (int)x << endl << (int)y << endl;
}

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

double to_radian(int angle) {
  return double(angle) * PI / 180.0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int len,angle;
  double x,y,rad;
  x = y = 0.0;
  rad = to_radian(90);
  while(scanf("%d,%d",&len,&angle)) {
    if((len | angle) == 0) break;
    x += len * cos(rad);
    y += len * sin(rad);
    rad = rad - to_radian(angle);
  }
  cout << int(x) << endl;
  cout << int(y) << endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int d, r;
	int w = 0;
	double  x = 0, y = 0;
	char n;
	 

	 while(1){

	 	cin >> d >> n >> r;
	 	
	 	if(d == 0 && n == ',' && r == 0) break;
	 	
	 	x += d * sin(w * M_PI / 180);
	 	y += d * cos(w * M_PI / 180);
	 	w += r;
	 	
	 
	 	
	 }
	 cout << endl;
	 cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  double d, t, x, y, n;
  x = y  = 0;
  n = 90;
  while(scanf("%lf,%lf", &d, &t) && (d || t)){
    y += d * sin(n * M_PI / 180);
    x += d * cos(n * M_PI / 180);
    n -= t;

  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include<stdio.h>
#include<math.h>

typedef long double ldouble;

const ldouble PI = acos(-1.0);
const ldouble eps = 1e-10;

ldouble mysin(ldouble x) {
    ldouble ret = 0.0, now = x, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 2) * (2 * i + 3);
    }
    return ret;
}

ldouble mycos(ldouble x) {
    ldouble ret = 0.0, now = 1, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 1) * (2 * i + 2);
    }
    return ret;
}
int main()
{
    //printf("%.20f %.20f\n", (double)mycos(PI / 3), cos(PI / 3));
	int d,t;
	ldouble x=0,y=0;
    int dir = 0;
	while(scanf("%d%*c%d", &d, &t) &&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
	    while(dir >= 360) dir -= 360;
	    while(dir < 0) dir += 360;
		x -= d * sin(((ldouble)dir) * PI / 180.0);						//隶。邂?		y += d * cos(((ldouble)dir) * PI / 180.0);
	    dir -= t;
	}
    long long ox, oy;
    ox = x, oy = y;
	printf("%lld\n%lld\n", ox, oy);					//霎灘?

	return 0;
}

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

typedef complex<double> Point;

#define X real()
#define Y imag()
#define PI 3.1415926535

Point ans;
Point v = Point(0, 1);

int main() {
  while (1) {
    int a, b;
    scanf("%d,%d", &a, &b);
    if (a == 0 && b == 0) break;
    ans += double(a) * v;

    double t = double(-b)*PI/180;
    v *= Point(cos(t), sin(t));
  }

  printf("%d\n", int(ans.X));
  printf("%d\n", int(ans.Y));
}