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++: #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;
}