Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

C++: #include<iostream>
#include<iomanip>
#include<memory>
#include<array>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>

using namespace std;

double rad( double x )
{
  return x * 3.14159265358979 / 180;
}

int main()
{
  double r, t, g, x, y;
  char c;
  x = y = 0;
  g = 90;

  while( cin >> r >> c >> t )
    {
      x += r * cos( rad( g ) );
      y += r * sin( rad( g ) );
      g -= t;
    }

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

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

using namespace std;

int main(int argc, char *argv[])
{
  double x,y;
  double sumE = 0;
  double sumN = 0;
  double rad = M_PI/2.0;
  while(scanf("%lf,%lf",&x,&y) !=EOF ){
    getchar();
    if(x ==0&& y== 0)
      break;
    sumE += x*cos(rad);
    sumN += x*sin(rad);
    rad  -= y*M_PI/180;
  }
  cout <<(int)sumE <<endl<<(int)sumN <<endl;
  return 0;
}

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

int main(){
    int tmp1;
    int tmp2;
    int radiant = 0;
    double x = 0;
    double y = 0;

    while(scanf("%d,%d", &tmp1, &tmp2), (tmp1 != 0 || tmp2 != 0)){
        x += tmp1 * sin(radiant * M_PI / 180.0);
        y += tmp1 * cos(radiant * M_PI / 180.0);
        radiant += tmp2;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

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