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