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++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_r = M_PI_2;
	int x,r; char c;
	while(cin>>x>>c>>r,(x||r)){
		P add = P(x,0) * P(cos(c_r),sin(c_r));
		p += add;
		c_r -= r / 180.0 * M_PI;
	}

	cout << (int)p.real() << " " << (int)p.imag() << endl;

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

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*M_PI/180);
		h+=x*cos(r*M_PI/180);
		r-=y;
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

using namespace std;

//0016
int main(){
	const double PI = M_PI;
	double x=0.0, y=0.0;
	int deg;
	int acc=90;
	int f=0;

	while(1){
		scanf("%d,%d", &f, &deg);
		if(!f && !deg)break;

		double rad = (double)acc/180*PI;
		x += f * cos(rad);
		y += f * sin(rad);
		acc = (acc - deg);

	}

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

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#define PI 3.14159265358979
double rad(double a){
  return a*PI/180.0;
}

int main(){
  int a,b;
  int th=0;
  double x = 0, y = 0;
  while(scanf("%d,%d",&a,&b)){
    if(a==0&&b==0)break;
    x+=(double)a*sin(rad(th));
    y+=(double)a*cos(rad(th));
    th+=b;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

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

using namespace std;

int main(void) {
	int len, rot;
	int deg;
	double north, east;
	
	deg = 0;
	north = 0; east = 0;
	while(true) {
		scanf("%d,%d", &len, &rot);
		if(len == 0 && rot == 0) { break; }
		north += sin(deg * 3.1415927 / 180.0) * len;
		east += cos(deg * 3.1415927 / 180.0) * len;
		deg += rot;
	}
	
	printf("%d\n%d\n", (int)north, (int)east);
	
	return 0;
}

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

int main()
{
	int len, angle;
	int sum_ang = 90; // start
	double x = 0.0, y = 0.0;

	// ang(+) -> right 
	while (scanf("%d,%d", &len, &angle), len != 0 || angle != 0){
		x += len * cos(M_PI * sum_ang / 180.0);
		y += len * sin(M_PI * sum_ang / 180.0);

		sum_ang = (sum_ang - angle + 360) % 360;
	}

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

	return (0);
}

C++: #include<bits/stdc++.h>
using namespace std;
static const double pi = 2.0 * acos(0.0);

int d, a;

int main(){
	double theta = pi / 2;
	double x = 0.0, y = 0.0;
	while(1){
		scanf("%d,%d", &d, &a);
		//cout << d << " " << a << endl;
		if(d == 0.0 && a == 0.0) break;
		x += d * cos(theta); y += d * sin(theta);
		theta -= (double)a / 180.0 * pi;
		//cout << x << " " << y << endl;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0;
}

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

using namespace std;

int main() {
    int a=1;
    int b=1;
    
    double degree=90.0;
    
    double x=0.0;
    double y=0.0;

    while (a!=0&&b!=0){
        scanf("%d,%d",&a,&b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<endl<<(int)y<<endl;
    
    return 0;
}

C++: #include<cmath>
#include<cstdio>
using namespace std;
#define PI 3.1415926535898
int main(){
	double x = 0,y = 0,dis,ang,angnow = 90;
	for(;;){
		scanf("%lf,%lf",&dis,&ang);
		if(dis == 0 && ang == 0){break;}
		x+=dis*cos(angnow*PI/180);
		y+=dis*sin(angnow*PI/180);
		angnow-=ang;
	}
	x = (int)x/1;
	y = (int)y/1;
	printf("%.0lf\n%.0lf\n",x,y);
	return 0;
}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main(){
	int step,dir;
	double x=0.0, y=0.0, angle=0.0;
	
	while(1){
		scanf("%d,%d", &step, &dir);
		if(step==0 && dir==0) break;
		x += (double)(step) * sin( angle*ANGLE );
		y += (double)(step) * cos( angle*ANGLE );
		angle += (double)dir;
	}
	printf("%d\n%d\n", (int)x, (int)y);
}

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

int main(){
  double x=0;
  double y=0;
  double angle=0;
  double r,th;
  while(1){
    scanf("%lf,%lf",&r,&th);
    if(r==0&&th==0)break;
    x+=r*sin(angle);
    y+=r*cos(angle);
    angle+=th;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

C++: #include<stdio.h>
#include<cmath>
#include<iostream>
 
#define PI 3.14159265358979323846
using namespace std;
 
int length, angle, currentAngle;
double px, py;
  
void walk(){
    double dx = length * cos(currentAngle * PI / 180.0);
    double dy = length * sin(currentAngle * PI / 180.0);
    currentAngle -= angle;
    px += dx;
    py += dy;
}
 
main(){
    px = 0;
    py = 0;
    currentAngle = 90;
    while(1){
    scanf("%d,%d", &length, &angle);
    if ( length == 0 && angle == 0 ) break;
    walk();
    }
    int x = (int)px;
    int y = (int)py;
    printf("%d\n", x);
    printf("%d\n", y);
}

C++: #include <iostream>
#include <algorithm>
#include <complex>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
typedef complex<double> P;

const double pi = acos(-1);

int main() {
  string s;
  double rad = pi/2.0;
  P pos(0,0);
  while(cin >> s) {
    replace(s.begin(), s.end(), ',', ' ');
    stringstream ss(s);
    double n;
    double d;
    ss >> n >> d;
    if(n == 0.0 && d == 0.0) break;
    d = -d*pi/180.0;
    pos += n*P(cos(rad),sin(rad));
    rad += d;
  }
  cout << (int)pos.real() << endl;
  cout << (int)pos.imag() << endl;
  return 0;
}

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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c)*a;
		y += sin(c)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x << y << endl;

	return 0;
}

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

const double PI = acos(-1.0);

int main(){
    int d,r,t = 0;
    char c;
    double x = 0,y = 0;
    while(scanf("%lf,%lf",&d,&r) && (d || r)){
        x += d * sin((t) * PI / 180.0);
        y += d * cos((t) * PI / 180.0);
        t += r;
    }
    printf("%d\n%d\n",(int)x,(int)y);
    return 0;
}

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

#define PI 3.14159265359

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 <complex>
#include <cmath>
using namespace std;

typedef complex<double> P;
const double PI = acos(-1);

int main() {  
  P p;
  P dir(0, 1.0);

  for(;;) {
    int x, y;
    scanf("%d,%d", &x, &y);
    if( x == 0 && y == 0 ) break;
    cout << x << " " << y << endl;
    p += dir * (double)x;
    dir *= polar(1.0, -y / 180.0 * PI);    
  }
  
  printf("%d\n%d\n", (int)p.real(), (int)p.imag());
  
}