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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second.first
#define T4 second.second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

typedef complex<double> P;

int main(){
	P p(0,0),v(0,1);
	int x,y;
	while(1){
		scanf("%d,%d", &x, &y);
		if(x==0 && y==0){
			double rx = floor(real(p));
			if(rx<0)rx+=1.01;
			double ry = floor(imag(p));
			if(ry<0)ry+=1.01;
			printf("%.0f\n%.0f\n", rx, ry);
			break;
		}
		p+=v*P(x*1.0, 0.0);
		v*=P(cos(-y*1.0/180.0*acos(-1.0)), sin(-y*1.0/180.0*acos(-1.0)));
	}
	return 0;
}

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

#define PI 3.1415926535897932

using namespace std;

int main() {
	int hosu;
	int kaku1 = 90;
	int kaku2;
	char a;
	double kita = 0.0;
	double higasi = 0.0;

	while(1) {
		cin >> hosu >> a >> kaku2;

		if(hosu == 0 && kaku2 == 0) {
			break;
		}

		kita += hosu * sin(PI * (double)kaku1 / 180.0);
		higasi += hosu * cos(PI * (double)kaku1 / 180.0);

		kaku1 += kaku2;
	}

	cout << -(int)higasi << endl << (int)kita << endl;

	return 0;
}

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

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(M_PI * sum_angle / 180);
		y += l * sin(M_PI * sum_angle / 180);

		sum_angle = (sum_angle - a) % 360;
	}

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

	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 << '\n';
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	double d,r,n=90,x=0,y=0;
	char k;//????????????????????????
	while(1){
		cin>>d>>k>>r;
		if(d==0&&r==0) break;
		x+=d*cos(M_PI*n/180);
		y+=d*sin(M_PI*n/180);
		n-=r;
	}
	cout<<(int)x<<endl<<(int)y<<endl;
}

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

constexpr auto PI = 3.14159265358979323846264338;

auto main () -> int
{
    int d , t;
    double x = 0 , y = 0;
    int angle = 0;
    while (std::scanf ("%d,%d" , & d , & t) == 2 && d && t)
    {
        x += d * std::sin (angle * PI / 180.0);
        y += d * std::cos (angle * PI / 180.0);
        angle += t;
    }
    std::cout << static_cast <int> (x) << std::endl;
    std::cout << static_cast <int> (y) << std::endl;
}

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("%d\n%d\n",(int)x,(int)y);
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
using namespace std;
int main( void )
{
	double x = 0.0, y = 0.0, angle = 0.0;

	int walk, rotate;
	char split;
	string input;
	while ( cin >> input && input != "0,0" )
	{
		istringstream is( input );
		is >> walk >> split >> rotate;

		double radian = angle * M_PI / 180.0;
		x += walk * sin( radian );
		y += walk * cos( radian );
		angle += rotate;
	}

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

	return 0;
}

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

#define PI 3.1415926535

int main() {
	int dir=90, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d,%d",&adv,&rad)&&adv!=0&&rad!=0) {
		x += cos(dir*PI/180)*adv;
		y += sin(dir*PI/180)*adv;
		dir -= rad;
		if (dir < 0) dir += 360;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,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;
}