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

int main() {
    int angle = 90;
    double x = 0, y = 0, radian = M_PI * angle / 180;
    while (true) {
        int d, t;
        scanf("%d,%d", &d, &t);
        if (d == 0 && t == 0)
            break;

        x += d * cos(radian);
        y += d * sin(radian);
        angle -= t;
        radian = M_PI * angle / 180;
    }
    printf("%d\n%d\n", (int)x, (int)y);
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_th = 90;
	double r,th; char c;
	while(cin>>r>>c>>th,(r||th)){
		P add = P(r,0) * P(cos(c_th * M_PI / 180),sin(c_th* M_PI / 180));
		p += add;
		c_th -= th;
	}

	cout << (int)p.real() << " " << (int)p.imag() << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    double x=0,y=0,theta=0;
    double a,b;
    scanf("%lf,%lf",&a,&b);
    while(a||b){
        y += a*cos(rad(theta));
        x += a*sin(rad(theta));
        theta += b;
        scanf("%lf,%lf",&a,&b);
    }
    x = (abs(x)<=(1e-9))?0:x;
    y = (abs(y)<=(1e-9))?0:y;
    printf("%.0lf %.0lf",x,y);
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x = 0,y = 0,a,b,ang = 90;
  for(;;){
    scanf("%lf,%lf",&a,&b);
    if(a == 0 && b == 0) break;
    x+=a*cos(ang*M_PI/180);
    y+=a*sin(ang*M_PI/180);
    ang-=b;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

const double PI = 3.14159265358979323846;

struct Vec2
{
	double x;
	double y;
	Vec2( double ix, double iy ):x(ix),y(iy){}
};

class Turtle
{
	Vec2 pos;
	double angle;
public:
	void forward(double length)
	{
		pos.x += length * cos(angle);
		pos.y += length * sin(angle);
	}
	void rotate( double angle1 )
	{
		angle -= angle1;
	}
	Vec2 GetPos(){return pos;}
	Turtle() : pos(Vec2(0.0,0.0)), angle(0.0){}
	Turtle( Vec2 v, double a ) : pos(v), angle(a){}
};

int main()
{
	Turtle turtle(Vec2(0.0,0.0),PI*0.5);
	int l,a;
	while(scanf("%d,%d",&l,&a),l||a)
	{
		turtle.forward(l);
		turtle.rotate(a*PI/180.0);
	}

	int x = static_cast<int>( turtle.GetPos().x );
	int y = static_cast<int>( turtle.GetPos().y );
	std::cout << x << '\n' << y;
}

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

#define Pai 3.141592653589793
int main(void)
{
	double x=0,y=0,l=90,n,m;
	
	while(1){
		scanf("%lf,%lf",&n,&m);
		if (n==0&&m==0) {
			break;
		}
		y+=(double)n*sin((double)l*Pai/180.0);
		x+=(double)n*cos((double)l*Pai/180.0);
		l-=(double)m;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	
	return (0);
}

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

int main() {
	int dis1, rad1,dis2=0,rad2=0;
	double x = 0, y = 0,PI= 3.141592653589793;
	scanf("%d , %d", &dis1, &rad1);
	y += dis1; rad2 = rad1;
	while (scanf("%d , %d",&dis1,&rad1)) {
		if (dis1 != 0) {
			x += dis1*sin(rad2*PI/180);
			y += dis1*cos(rad2*PI/180);
			rad2 += rad1;
		}
		else {
			cout << int(x) << endl;
			cout << int(y) << endl;
			break;
		}
	}
	return 0;
}

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

int main()
{
    int L,C,W=0;
    double x=0,y=0;
    char c;
    while(1){
        cin >> L >> c >> C;
        if(!(L||C)){
            break;
        }
        x=x+(double)L*sin(W/180.0*M_PI);
        y=y+(double)L*cos(W/180.0*M_PI);
        W+=C;
    }
    cout << (int)x << "\n" << (int)y << endl;
}

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

int main() {
	int dis1, rad1,dis2=0,rad2=0;
	double x = 0, y = 0,PI= 3.141592653589793;
	scanf("%d , %d", &dis1, &rad1);
	y += dis1; rad2 = rad1;
	while (scanf("%d , %d",&dis1,&rad1)) {
		if (dis1 != 0) {
			x += dis1*sin(rad2*PI/180);
			y += dis1*cos(rad2*PI/180);
			rad2 += rad1;
		}
		else {
			cout << int(x) << endl;
			cout << int(y) << endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cmath>

using namespace std;

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

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

using namespace std;

int main()
{
	int walk,ang;
	char c;
	double x=0.0,y=0.0,angle = 90;

	while (cin >> walk >> c >> ang)
	{

		if (walk == 0 && ang == 0) break;
		x += cos(angle*M_PI / 180)*walk;
		y += sin(angle*M_PI / 180)*walk;
		angle -= ang;

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

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double d = 0.0;	// ????????????????????¢
	double a = 0.0;	// ?????????????????????
	double x = 0.0;
	double y = 0.0;
	int ak = 90;	// ???????????????90????????????
	while (true)
	{
		scanf_s("%lf,%lf", &d, &a);	// double?????????????????????%f??§????????????%lf?????????
		if (d == 0 && a == 0) { break; }
		x += cos(ak*M_PI / 180) * d;
		y += sin(ak*M_PI / 180) * d;
		ak -= a;
		ak %= 360;
	}
	// ??????
	cout << (int)x << "\n" << (int)y << endl;
	return 0;
}

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

using namespace std;

int main()
{
	double x = 0, y = 0, a, b, agl = 90, rad = 3.14159265358998 / 180;

	while(1){
		scanf("%lf,%lf", &a, &b);
		if(a == 0 && b == 0)    break;

		x += a * cos(rad * agl);
		y += a * sin(rad * agl);

		agl -= b;
	}

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

	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	double PI = acos(-1.0);
	double X = 0, Y = 0;
	int angle = 90;
	while (true) {
		int x, y;char c;cin >> x >> c >> y;
		if (x == 0 && y == 0) break;
		X += x*cos(angle / 180.0 *PI);
		Y += x*sin(angle / 180.0*PI);
		angle += y;
	}
	cout << -(int)X << endl << (int)Y << endl;
}