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

C++:  
  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 const double pi=3.14159265;
 
 int main()
 {
   int step,degree;
   double x,y;
   x=0;
   int count=0;
   double final_degree=0;
   char temp;
   while(cin>>step>>temp>>degree)
   {
     if(step==0&&degree==0) break;
     else
     {
       x=x+sin(final_degree/180*pi)*step;
       y=y+cos(final_degree/180*pi)*step;
       final_degree+=degree;
     }                        
   }
   printf("%.0lf\n%.0lf\n",x,y);
   //while(1);      
   return 0;    
 }