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

C++: #ifndef POINT_RADIAN_H
#define POINT_RADIAN_H

#include <iostream>
#include <cmath>

using namespace std;

static const double PI = 3.141592;


class Point{
public:
    double x, y;
    Point(double x=0, double y=0): x(x),y(y){}

    Point operator + (Point p) {return Point(x+p.x, y+p.y);}
    Point operator - (Point p) {return Point(x-p.x, y-p.y);}
    Point operator * (double a) {return Point(a*x, a*y);}
    Point operator / (double a) {return Point(x/a, y/a);}

};

int main(){
    int d, a;
    int degree(0);
    Point p;
    double radian = 0;
    
    while (scanf("%d,%d",&d, &a)){
        if(d == 0 && a == 0){break;}
        radian = degree * (PI/180);
        p.x = p.x + d * sin(radian);
        p.y = p.y + d * cos(radian);
        degree += a;

    }
    cout << static_cast<int>(p.x) << "\n";
    cout << static_cast<int>(p.y) << "\n";


}


#endif // POINT_RADIAN_H

C++: #include<cstdio>
#include<cmath>
constexpr double pi(){return std::atan(1)*4;}
double degToRad(double deg){
  return deg * pi() / 180;
}
int main(){
  double x=0,y=0,angle=0;
  for(;;){
    int leng,rot;
    scanf("%d,%d",&leng,&rot);
    if(!(leng|rot)){break;}
    y+=cos(degToRad(angle))*leng;
    x+=sin(degToRad(angle))*leng;
    angle+=rot;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

const ll inf = INT_MAX;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	int r;
	double x=0, y=0;
	double ini = pi/2, alpha, theta;
	cout << endl;
	while(scanf("%d,%lf\n", &r, &theta)){
		if(r == 0 && std::abs(theta - 0.0) < eps){
			// printf("finished\n");
			break;
		}
		else{
			x += r*cos(ini);
			y += r*sin(ini);
			alpha = pi*theta/180;
			ini -= alpha;
		}
	}
	printf("%d %d\n", (int)x, (int)y);
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<cstdio>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		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", (int)x, (int)y);

	return 0;

}

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

int main(){
	double a;
	double b;
	double now=90;
	double x=0,y=0;
	double PI=3.14159265358;
	while(1){
		scanf("%lf,%lf",&a,&b);
		if(a==b&&b==0)break;
		x+=cos(now*PI/180)*a;
		y+=sin(now*PI/180)*a;
		now-=b;
	}
	printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define PI 3.14159265358979323846264

using namespace std;

int main()
{
	double x=0,y=0,theta=90;
	int a,b,ansx,ansy;

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*cos(theta*PI/180);
		y+=a*sin(theta*PI/180);

		theta-=b;
		scanf("%d,%d",&a,&b);

	}

	ansx=x; ansy=y;

	cout<<ansx<<endl<<ansy<<endl;

	return 0;
}