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 <iostream>
#include <cmath>
using namespace std;
const double dtr=atan(1)/45;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double x=0, y=0;
    int dir=90;
    while(true){
        int d, a;
        cin>>d;
        cin.ignore();
        cin>>a;
        if(d==0&&a==0) break;
        x+=d*cos(dir*dtr);
        y+=d*sin(dir*dtr);
        dir-=a;
    }
    cout<<(int)x<<'\n'<<(int)y<<'\n';
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.);
typedef complex<double> P;

P p;
double dir = pi / 2.;

int main()
{
	p = P(0, 0);
	double n, d;
	while (scanf("%lf,%lf", &n, &d), (int)n | (int)d){
		p += polar(n, dir);
		dir -= d * pi / 180;
	}
	
	printf("%d\n%d\n", (int)p.real(), (int)p.imag());
	
	return 0;
}

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

using namespace std;

double dig2rad(double dig){return dig*M_PI/180.0;}

int main(void){
	int step,rot;
	char delim;
	double x=0,y=0,ang=90;

	while(cin >> step >> delim >> rot,step||rot){
		x+=step*cos(dig2rad(ang));
		y+=step*sin(dig2rad(ang));
		ang-=rot;
	}
	cout << (int)x << endl << (int)y << endl;

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define PAI 3.1415926
#define DtoR(ang)	((ang*PAI)/180)
#define GOSA(x) (x>0?1e-5:-1.0*1e-5)

struct Pos{
	double x,y;
};

void VAdd(Pos *v1,Pos *v2){
	v1->x += v2-> x;
	v1->y += v2-> y;
}
Pos AtoV(double vsize,double ang){	//極座標を直交座標に変換
	Pos v;
	v.x = vsize*cos(ang);
	v.x += GOSA(v.x);
	v.y = vsize*sin(ang);
	v.y += GOSA(v.y);
	return v;
}
int main(){
	double vsize,ang,sum_ang = 90;
	Pos sumv = {0,0},v;
	while(~scanf("%lf,%lf",&vsize,&ang)){
		v = AtoV(vsize,DtoR(sum_ang));
		VAdd(&sumv,&v);
		sum_ang -= ang;
	}
	printf("%.0lf\n%.0lf\n",sumv.x,sumv.y);
	return 0;
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

void solve()
{
	int step, delta_theta;
	double x = 0;
	double y = 0;
	int theta = 90;
	while(scanf("%d,%d", &step, &delta_theta))
	{
		if(!step && !delta_theta)
		{
			break;
		}
		x += step * cos(theta * M_PI / 180);
		y += step * sin(theta * M_PI / 180);
		theta -= delta_theta;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
}

int main()
{
	solve();
	return(0);
}

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

int main(){
  int r,rad,nrad;
  double x,y;
  x = y =  nrad = 0;
  while(true){
    scanf("%d,%d",&r,&rad);
    if(r+rad == 0)break;
    x += r*sin(nrad*(M_PI/180));
    y += r*cos(nrad*(M_PI/180));
    nrad += rad;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const double PI = acos(-1.0);

int main()
{
	double X = 0.0,Y = 0.0;
	int A,B,R = 90;
	while(scanf("%d,%d",&A,&B) && A && B){
		X += A * cos(R * PI / 180.0);
		Y += A * sin(R * PI / 180.0);
		R -= B;
		if(R > 180) R -= 360;
		if(R < -180) R += 360;
	}

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

	return 0;
}

C++: #include<iostream>
#include<math.h>
#define PI 3.14159265358979
using namespace std;
int main(void){
    double d,a,x=0,y=0,degree=90;
    char c;
    while(cin >> d >> c >> a){
        if(d==0 && a==0)  break;
        x=x+cos(PI*degree/180)*d;
        y=y+sin(PI*degree/180)*d;
        degree=degree-a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#define M_PI 3.14159265358979 /* ?????¨??? */

using namespace std;

int main(){
    int len, deg;
    int deg_now = 90;
    double x = 0, y = 0;

    while (1){
        scanf("%d,%d", &len, &deg);
        if (len == 0 && deg == 0) break;
        x += len*cos(deg_now* M_PI / 180);
        y += len*sin(deg_now* M_PI / 180);
        deg_now -= deg;
    }

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

    return 0;

}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
#define PI (acos(-1))

int main() {
	int d,a,kakudo=0;
	long double x=0, y=0;
	while (1) {
		scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0)
			break;
		y += d*cos(kakudo*PI / 180.0);
		x += d*sin(kakudo*PI / 180.0);
		kakudo = (kakudo + a) % 360;
	}
	cout << (int)x << endl << (int)y <<endl;
	return 0;
}

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

typedef complex<double> P;
const double PI = acos(-1);

int main() {  
  P p;
  P dir(0, 1.0);

  for(;;) {
    int x, y;
    scanf("%d,%d", &x, &y);
    if( x == 0 && y == 0 ) break;
    p += dir * (double)x;
    dir *= polar(1.0, -y / 180.0 * PI);    
  }
  
  printf("%d\n%d\n", (int)p.real(), (int)p.imag());
  
}