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<stdio.h>
#include<math.h>
int main()
{
double N,P;
double x,y;

x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P);
if((int)N==0&&(int)P==0)break;
double p;
if(0<=(int)P&&(int)P<90){p=P*3.141592/180;x+=N*sin(p);y+=cos(p);}
else if(90<=(int)P&&(int)P<=180){p=(180-P)*3.141592/180;x+=N*sin(p);y-=cos(p);}
else if(0>(int)P&&(int)P>=-90){p=(-1*P)*3.141592/180;x-=N*sin(p);y+=cos(p);}
else if(-90>(int)P&&(int)P>=-180){p=(180+P)*3.141592/180;x-=N*sin(p);y-=cos(p);}
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

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

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned uint;

const double PI = acos(-1.0);

double X, Y, P;
int D, A;

int main(void) {
	X = 0.0;
	Y = 0.0;
	P = 90.0;

	for ( ; scanf("%d,%d", &D, &A) == 2 && !(A == 0 && D == 0); ) {
		X = X + cos(P * PI / 180) * D;
		Y = Y + sin(P * PI / 180) * D;
		P -= A;
	}
	printf("%d\n%d\n", (int) X, (int) Y);
    return 0;
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
using namespace std;
int main() {
  double x, y, walk, deg, rad = M_PI_2;
  char c;
  while (cin >> walk >> c >> deg) {
    if (walk == 0 && deg == 0) break;
    x += walk * cos(rad);
    y += walk * sin(rad);
    rad -= deg * M_PI / 180;
  }
  cout << (int) x << endl << (int) y << endl;
}

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

using namespace std;

int main() {
    int r, degree;
    int sum_degree = 0;
    double wx = 0, wy = 0;
    char comma;

    while (true) {
        cin >> r >> comma >> degree;
        if (!r && !degree) {
            break;
        }

        // the input of sin and cos is radian
        wx += r * sin(M_PI / 180.0 * sum_degree);
        wy += r * cos(M_PI / 180.0 * sum_degree);

        sum_degree = (sum_degree + degree) % 360;
    }

    cout << (int)wx << "\n" << (int)wy << endl;

    return 0;
}

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

int main() {
	cout << fixed << setprecision(0);
	ios :: sync_with_stdio(false);
	db d, t; char c;
	db x, y, a;
	while(cin >> d >> c >> t) {
		a -= t;
		x += d * cos(a);
		y += d * sin(a);
	}
	cout << x << ' ' << y << '\n';
	return 0;
}

C++: #include <iostream>
#include<cmath>
#include<iomanip>
#include<stdio.h>
using namespace std;

const double pi = 3.1415926535897932385;

int main()
{
	int direction = 0, distance = 0;
	double x = 0, y = 0, a = 0;
	while (scanf("%d,%d", &distance, &direction)!=EOF)
	{
		if (direction == distance && direction == 0)
		{
			cout << (int)y << '\n' << (int)x << endl;
			x = y = a = 0;
		}
		else
		{
			x += (distance*cos(a));
			y += (distance*sin(a));
			a += (double)direction / 180 * pi;
		}
	}
	return 0;
}

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

using namespace std;
#define PI 3.141592

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

	while(cin >> value >> c >> value_2)
	{
		if(value == 0 && value_2 == 0) break;

		x += cos(angle*PI/180)*value;
		y += sin(angle*PI/180)*value;
		angle -= value_2;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    double x,y,a,c,rad;
    a=c=0;
    rad=M_PI/2;
    while(scanf("%lf,%lf",&x,&y),x||y){
        a+=x*sin(rad);
        c+=x*cos(rad);
        rad-=y/180*M_PI;
    }
    cout<<(int)c<<endl<<(int)a<<endl;
    return 0;
}

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

#define PI 3.141592

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*PI/180);
		h+=x*cos(r*PI/180);
		r-=y;
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

#define PI 3.141592654

int main() {
	double coor[3] = { 0,0,90 };
	int length, angle;
	while (1) {
		scanf("%d,%d", &length, &angle);
		if (length == 0 && angle == 0)break;
		coor[0] += (double)length * cos((double)coor[2] * PI / 180);
		coor[1] += (double)length * sin((double)coor[2] * PI / 180);
		coor[2] -= angle;
		printf("test %d %d %d\n", (int)coor[0], (int)coor[1],(int)coor[2]);
	}
	printf("%d\n%d\n", (int)coor[0], (int)coor[1]);
	return 0;
}

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

#define PI 3.14159265359

int main()
{
    int d, a;
    char c;
    int r = 90;
    double x, y;

    while (cin >> d >> c >> a) {
        if (d == 0 && a == 0) {
            break;
        }
        else {
            double ans = r * (PI / 180.0);
            x += d * cos(ans);
            y += d * sin(ans);
            r += a;
        }
    }
    cout << -1 * (int)x << endl;
    cout << (int)y << endl;

    return (0);
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){
    double x=0,y=0,a,b,an=90;
    char c;
    while(cin>>a>>c>>b,a,b){
        x+=a*cos(an/180.0*M_PI);
        y+=a*sin(an/180.0*M_PI);
        an-=b;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265359;
int main(){
  double now=pi*0.5;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now)*a;
    yy=sin(now)*a;
    x+=xx;
    y+=yy;
    now-=(b/180*pi);
    if(now>=2*pi)now-=2*pi;
    if(now<=-2*pi)now+=2*pi;
    
    
    
  }  
  printf("%.0lf %.0lf\n",x,y);
}

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

int main() {
  int w;
  double ang = M_PI/2; int angInt;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>angInt, w != 0 && angInt != 0) {
    x += w * cos(ang), y += w * sin(ang);
    ang -= angInt*M_PI/180.0;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", &len, &rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << (int)y <<  endl;
  cout << (int)x << endl;
  return 0;
}