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<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 (scanf("%d,%d", len, deg)){
		if (len == 0 && deg == 0) break;
		x = len*cos(deg_now / 180.0 * M_PI);
		y = len*sin(deg_now / 180.0 * M_PI);
		deg_now += deg;
	}

	printf("%d\n%d\n", x, y);

	return 0;

}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	int a, b;

	double x = 0; 
	double y = 0;
	int radius = 0;


	while (scanf("%d,%d", &a, &b), a&&b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius += b;
	}
	y *= 10;
	y %= 10;
	y /= 10;

	x *= 10;
	x %= 10;
	x /= 10;

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

C++: #include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
double x=0.0,y=0.0,d=90;

	while (1){
		string s1, s2;
		getline(cin,s1 , ',');
		getline(cin, s2);
		if (s1 == "0"&&s2 == "0")
		break;
		double m = atof(s1.c_str());
		double r = atof(s2.c_str());
		x += cos(d/360.0*2.0*3.14159265)*m;
		y += sin(d / 360.0*2.0*3.14159265)*m;
		d-=r;
	}
	cout << (int)x << endl << (int)y<<endl;
}

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

#define PI 3.1415926535898
#define AG (PI/180.0)

int main() {
	int rad, adv;
	double x=0.0, y=0.0,dir=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&(adv!=0.0||rad!=0.0)) {
		x += (double)adv*sin(dir*AG);
		y += (double)adv*cos(dir*AG);
		dir += (double)rad;
	}
	printf("%d\n%d\n",(int)x,(int)y);
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int d, a;
  char gomi;
  double x = 0, y = 0, p = 0;
  while (cin >> d >> gomi >> a, d) {
    x += d * sin(p * PI / 180.0);
    y += d * cos(p * PI / 180.0);
    p += a;
  }
  cout << (int) x << '\n'
       << (int) y << endl;
}

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<<(int)x<<endl;
	cout<<(int)y<<endl;
	return 0;
}

C++: #include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define	PI	3.14159265358979323846
#define	DEG2RAD(x)	((x) * PI / 180.)

void inputStr(char *str, size_t len) {
	fgets(str, len, stdin);
	if (str[(len = (strnlen(str, len) - 1))] == '\n') {
		str[len] = '\0';
	} else {
		fflush(stdin);
	}
}

void inputData(int &a, int &b) {
	char *str = new char[512], *tok;
	static const char period[] = ",";
	inputStr(str, 512);
	tok = strtok(str, period);
	if (tok != NULL) {
		a = atoi(tok);
		tok = strtok(NULL, period);
		if (tok == NULL) {
			inputStr(str, 512);
			tok = strtok(str, period);
		}
		b = atoi(tok);
	}
	delete [] str;
}

int main(void) {
	std::complex<double> r(0., 0.);
	int direction = 90;
	int distance, rotateRight;

	printf("x=%d\ny=%d\n", r.real(), r.imag());
	for (;;) {
		inputData(distance, rotateRight);
		if (distance == 0 && rotateRight == 0) { break; }
		r += std::polar<double>((double)distance, DEG2RAD((double)direction));
		direction -= rotateRight;
	}
	printf("%d\n%d\n", (int)r.real(), (int)r.imag());
	return 0;
}

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

int main() {
	int hosuu;
	int kakudo;
	double x, y = 0;
	double degree = M_PI/2;
	char comma;
	while(1) {
		cin >> hosuu >> comma >>  kakudo;
		if(hosuu == 0 && kakudo ==0) break;
		else {
			x += cos(degree) * hosuu;
			y += sin(degree) * hosuu;
			degree -= (double)kakudo / 180 * M_PI;
		}
	}
	cout << int(x) << endl;
	cout << int(y) << endl;
	return 0;
}

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

#define PI 3.141592653589793
#define RAD(d) (d * PI / 180)

using namespace std;

class People{
private:
	int angle;
	double x, y;

public:
	People(){
		angle = 90;
		x = y = 0;
	}
	void move(int distance, int relativeAngle){
		x += distance * cos(RAD(angle));
		y += distance * sin(RAD(angle));
		angle -= relativeAngle;
	}
	double getX(){ return x; }
	double getY(){ return y; } 
};

int main(){
	People me;
	for(int distance, relativeAngle; ~scanf("%d,%d", &distance, &relativeAngle), distance;)
		me.move(distance, relativeAngle);
	cout << (int)me.getX() << endl << (int)me.getY() << endl;

	return 0;
}