Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x, y := 0.0, 0.0
	rotate := 90.0

	for {
		line := nextString()
		if line == "0,0" {
			break
		}

		numbers := strings.Split(line, ",")
		di, _ := strconv.ParseFloat(numbers[0], 64)
		ai, _ := strconv.ParseFloat(numbers[1], 64)

		rotateRadian := math.Pi * rotate / 180.0
		x += di * math.Cos(rotateRadian)
		y += di * math.Sin(rotateRadian)

		rotate -= ai

		// fmt.Println(x, y)
	}

	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>
#define PI 3.1415926535897932384626433832795

using namespace std;

double radian(int degree)
{
	return (PI * degree) / 180;
}

int main()
{
	double x = 0;
	double y = 0;
	int degree = 0;

	int walk, turn;
	while(true)
	{
		scanf("%d,%d", &walk, &turn);
		if(walk == 0 && turn == 0)
			break;

		x -= cos( radian(degree - 90) ) * walk;
		y -= sin( radian(degree - 90) ) * walk;
		degree -= turn;
	}

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

	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <stack>
#include <cmath>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  const double pi = acos(-1);
  double arg = pi / 2;
  double x = 0, y = 0;
  while (true) {
    double a, b;
    scanf("%lf,%lf", &a, &b);
    if (a == 0 and b == 0) break;
    x += a * cos(arg);
    y += a * sin(arg);
    arg += -2 * pi * b / 360;
  }
  printf("%d\n%d\n", (int)x, (int)y);
}

C++: #include<stdio.h>
#include<math.h>
#define PAI 3.1415926
#define DtoR(ang)	((ang*PAI)/180)

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);
	//if(v.x>0)v.x -= 1e-6;
	//else if(v.x < 0)v.x += 1e-6;
	v.y = vsize*sin(ang);
	//if(v.y>0)v.y -= 1e-6;
	//else if(v.y < 0)v.y += 1e-6;
	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;
	}
	if(sumv.x>0)v.x += 1e-5;
	else if(sumv.x < 0)v.x -= 1e-5;
	if(v.y>0)v.y += 1e-5;
	else if(v.y < 0)v.y -= 1e-5;
	int x = sumv.x;
	int y = sumv.y;
	printf("%d\n%d\n",x,y);
	return 0;
}

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

#define calc(x) (x*M_PI/180.0)

using namespace std;

int main()
{
  int a, b;
  double x=0, y=0, r=0;

  while(scanf("%d,%d",&a,&b) != EOF && !(a == 0 && b == 0)){
    x += (double)a*sin(calc(r));
    y += (double)a*cos(calc(r));
    r += (double)b;
  }
  printf("%d\n%d\n", (int)x, (int)y);

  return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main(void)
{
	int i=0,a,b,k=90;
	double x=0,y=0;

	while(i == 0)
	{
		scanf("%d,%d",&a,&b);

		if(a == 0 || b == 0)break;

		x += cos(k * M_PI / 180)*a;
		y += sin(k * M_PI / 180)*a;
		k -= b;
	}
  printf("%d\n",(int)x);
  printf("%d\n",(int)y);

  return 0;
}

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

using namespace std;

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

typedef vector<int> vi;

const double pi = atan(1.0)*4.0;

int main()
{
	double x=0.0, y=0.0;
	double direct = pi / 2.0;
	int len, arg;
	while(scanf("%d,%d", &len, &arg), len||arg){
		x += cos(direct) * len;
		y += sin(direct) * len;
		direct -= arg/180.0*pi;
	}

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

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

class THuman
{
public:
	void Move(int Distance);
	void Turn(int Degree);
	double GetX();
	double GetY();
	THuman();
private:
	double FX;
	double FY;
	int FDegree;
};

void THuman::Move(int Distance)
{
	FX += Distance * sin(FDegree * M_PI / 180);
	FY += Distance * cos(FDegree * M_PI / 180);
}

void THuman::Turn(int Degree)
{
	FDegree += Degree;
}

double THuman::GetX()
{
	return FX;
}

double THuman::GetY()
{
	return FY;
}

THuman::THuman()
{
	FX = 0;
	FY = 0;
	FDegree = 0;
}

int GetIntegerPart(double A)
{
	double IntegerPart;
	modf(A, &IntegerPart);
	return IntegerPart;
}

int main()
{
	THuman Human;
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human.Move(Distance);
		Human.Turn(Degree);
	}
	cout << GetIntegerPart(Human.GetX()) << endl << GetIntegerPart(Human.GetY()) << endl;
	return 0;
}

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

#include<cmath>
#define PI 3.1415926535898

int main(){

  int step,dir;

  double x=0.0,y=0.0,angle=0.0;

  while(1){
    scanf("%d,%d",&step,&dir);
    if(step == 0 && dir == 0)break;

    x+=(double)(step)*sin(angle/180.0*PI);
    y+=(double)(step)*cos(angle/180.0*PI);

    angle +=(double)dir;
    
  }

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

  return 0;

}

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

#define X 0
#define Y 1
#define PI 3.141592653589

int main()
{
    vector<double> udv = {0,1}; // 単位方向ベクトル
    vector<double> cur_position = {0, 0};

    int step=0, angle=0;
    while(1){
        
        scanf("%d,%d", &step, &angle);
        if( !step && !angle )break;

        cur_position.at(X) += udv.at(X)*step;
        cur_position.at(Y) += udv.at(Y)*step;

        // rotation
        double x =  cos(angle*PI/180.0)*udv.at(X) + sin(angle*PI/180.0)*udv.at(Y);
        double y = -sin(angle*PI/180.0)*udv.at(X) + cos(angle*PI/180.0)*udv.at(Y);
        udv.at(X) = x;
        udv.at(Y) = y;
        udv.at(X) = udv.at(X)/sqrt(udv.at(X)*udv.at(X)+udv.at(Y)*udv.at(Y));
        udv.at(Y) = udv.at(Y)/sqrt(udv.at(X)*udv.at(X)+udv.at(Y)*udv.at(Y));
    }    
    cout << static_cast<int>(cur_position.at(X)) << " " << static_cast<int>(cur_position.at(Y)) << endl;

    return 0;
}

C++: #include <iostream>

#define M_PI 3.141592653589793

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore(); //read ,
		cin >> deg;

		if(len == 0 && deg == 0) break;

		//proceed
		x += len * cos(direction * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		//turn clockwise
		direction -= deg;

		if(debug) cout << "(x, y) = ("<< x << ", "<< y << ")"<< endl;
	}

	i_x = (int)x;
	i_y = (int)y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

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

int main(){
  double ln,cta,x=0,y=0,angle=90.0;

  while(1){

  scanf("%lf,%lf",&ln ,&cta);
  if(ln==0&&cta==0)break;

  x += ln*cos((angle/180)*M_PI);
  y += ln*sin((angle/180)*M_PI);
  angle-=cta;
  }
  cout<< (int)x <<"\n"<< (int)y <<endl;

  return 0;
}

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

/* {{{ */
#define PI(N) (M_PI * (N)) / 180 //?§???????????????¢??????????????????
#define CL(N) cout << (N) << endl
#define DCT(N) cout << "debug " << (N) << endl
#define REP(i, N) for (int i = 0; i < (N); i++)
/* }}} */

int main()
{
    int l, a, sum_angle = 90;
    double x, y;

    x = y = 0.0;

    while (scanf("%d,%d", &l, &a), l || a){
        x += l * cos(PI(sum_angle));
        y += l * sin(PI(sum_angle));

        sum_angle = (sum_angle - a) % 360;
    }

    CL((int)x);
    CL((int)y);

    return (0);
}

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

using namespace std;

int main(){
    double x, y;
    int n, m, r;
    while(scanf("%d,%d", &n, &m), n+m){
        x += n*sin(r*M_PI/180.0);
        y += n*cos(r*M_PI/180.0);
        r += m;
    }
    cout << (int)x << "\n" << (int)y << endl;
}