Go: package main

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

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), int(y))
}

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;
}

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

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

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

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