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<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
signed main(){
        int a,b;
        double x=0,y=0;
        double d=90;
        while( scanf("%d,%d", &a, &b) != EOF ){
                if(a==0&&b==0) break;
                x+=a*cos(d*M_PI/180);
                y+=a*sin(d*M_PI/180);
                d-=b;
        }
        printf("%d\n%d\n",(int)x,(int)y);
        return 0;
}

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

using namespace std;

int main(){
  int distance, angle, _angle=0;
  double x=0, y=0, radian;
  char c;

  while(1){
    cin >> distance >> c >> angle;
    if(distance == 0 && angle == 0) break;

    radian = _angle * M_PI / 180;
    _angle += angle;

    x += distance * sin(radian);
    y += distance * cos(radian);
  }

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

C++: #include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  double a,b,x=0,y=0,s=0;
  while(scanf("%lf,%lf",&a,&b),a&&b){
    x+=a*cos(s*P/180);
    y+=a*sin(s*P/180);
    s+=b;
  }cout<<(int)y<<endl<<(int)x<<endl;
}

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;

	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<bits/stdc++.h>
using namespace std;
int d, a;
string s;
double x = 0, y = 0, p = 0, pi = 3.141592653589793238462643383279502884197169;
void f() {
	int p = 0, sig = 1;
	for (char ch : s) {
		if (ch == ',') {
			d = p*sig; p = 0; sig = 1;
		}
		else if (ch == '-')sig = -1;
		else p = p * 10 + ch - '0';
	}
	a = p * sig;
}
signed main() {
	while (cin >> s) {
		f();
		if (d == 0 && a == 0)break;
		x += d * sin(p * pi / 180);
		y += d * cos(p * pi / 180);
		p += a;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
		//cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

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

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

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

#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;
int main(void){

int ho,ka;
char mz;
double x=0,y=0,oka;
double pi=3.141519;
	oka=0;
	while(cin >> ho >>mz >> ka){
		if(ho == 0 && ka == 0) break;
		x += sin(oka*pi/180) * ho;
		y += cos(oka*pi/180) * ho;
		oka += ka;
	}
	cout << (int)x <<endl;
	cout << (int)y <<endl;
	
	return 0;
}

C++: #include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <math.h>
#define PI 3.141592
using namespace std;

int main() {
  ifstream cin("../test.txt");
  double x,y,ca,a,l;
  x = 0; y = 0; ca = PI / 2;
  char c;
  while (true) {
    cin >> l >> c >> a; // 進む距離と回転角度
    if (l == 0 && a == 0) break;

    x += l * cos(ca);
    y += l * sin(ca);

    ca -= a * PI / 180.0;
  }

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

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


double rad(int degree){
	return (M_PI*degree) / 180;
}


int main(){
	double x = 0, y = 0;
	int d, dir = 90, a;
	char comma;

	while (cin >> d >> comma >> a, d || a){
		x += d * cos(rad(dir));
		y += d * sin(rad(dir));
		dir -= a;
	}

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

	return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	double x = 0;
	double y = 0;
	double ang = 90;

	int d, a;
	char c;

	while( cin >> d >> c >> a ) {
		if( d == 0 && a == 0 ) { break; }

		x += d * cos( ang * 3.14159265358979 / 180.0 );
		y += d * sin( ang * 3.14159265358979 / 180.0 );
		ang -= a;
	}

	cout << (int)x << '\n' << (int)y << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;

int main(){
	string input;
	int ang;
	double x,y;
	x=0;
	y=0;
	ang=90;
	do{
		cin>>input;
		if (input[0]!='0'){
			int h,k;
			int *p;
			h=0;
			k=0;
			p=&h;
			bool mi_flg=false;
			REP(i,input.length()){
				if (input[i]==','){
					p=&k;
				}
				else if (input[i]!='-'){
					*p*=10;
					*p+=input[i]-'0';
				}
				else{
					mi_flg=true;
				}
			}
			if (mi_flg){
				k*=-1;
			}
			x+=h*cos(ang/180.0*M_PI);
			y+=h*sin(ang/180.0*M_PI);
			ang-=k;
		}
	}while(input[0]!='0');
	cout<<(int)x<<endl<<(int)y<<endl;
}

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

using namespace std;

int main() {
    double x, y, current_angle;
    int step, angle;
    x = 0, y = 0, current_angle = 90;

    while (true) {
        scanf("%d,%d", &step, &angle);

        if (!step && !angle) {
            break;
        }

        x += step * cos(current_angle * M_PI / 180);
        y += step * sin(current_angle * M_PI / 180);
        current_angle -= angle;
    }

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

    return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#define _USE_MATH_DEFINES

using namespace std;
int main(){
  int l,a;
  string sl,sa;
  double x,y,aa;
  x=y=aa=0;
  while(true){
  getline(cin,sl,',');
  getline(cin,sa,'\n');
  l = atoi(sl.c_str());
  a = atoi(sa.c_str());
  if (!l&&!a)break;
  x += sin(aa*(2*M_PI)/360)*l;
  y += cos(aa*(2*M_PI)/360)*l;
  aa += a;
  }
  cout << (int)x << endl << (int)y << endl;
}