Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

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

int main()
{
    int L,C,W=0;
    double x=0,y=0;
    char c;
    while(1){
        cin >> L >> c >> C;
        if(!(L||C)){
            break;
        }
        x=x+(double)L*sin(W/180.0*M_PI);
        y=y+(double)L*cos(W/180.0*M_PI);
        W+=C;
    }
    cout << (int)x << "\n" << (int)y << endl;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;

int main() {
	int dis1, rad1,dis2=0,rad2=0;
	double x = 0, y = 0,PI= 3.141592653589793;
	scanf("%d , %d", &dis1, &rad1);
	y += dis1; rad2 = rad1;
	while (scanf("%d , %d",&dis1,&rad1)) {
		if (dis1 != 0) {
			x += dis1*sin(rad2*PI/180);
			y += dis1*cos(rad2*PI/180);
			rad2 += rad1;
		}
		else {
			cout << int(x) << endl;
			cout << int(y) << endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cmath>

using namespace std;

int main() {
	int d, a; double rad = 0; double x = 0, y = 0;
	while (true) {
		scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0)break;
		y += d*cos(rad*M_PI/180);
		x += d*sin(rad*M_PI/180);
		rad =rad+a;
	}
	cout <<int(x) << endl <<int(y) << endl;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<math.h>

using namespace std;

int main()
{
	int walk,ang;
	char c;
	double x=0.0,y=0.0,angle = 90;

	while (cin >> walk >> c >> ang)
	{

		if (walk == 0 && ang == 0) break;
		x += cos(angle*M_PI / 180)*walk;
		y += sin(angle*M_PI / 180)*walk;
		angle -= ang;

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

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double d = 0.0;	// ????????????????????¢
	double a = 0.0;	// ?????????????????????
	double x = 0.0;
	double y = 0.0;
	int ak = 90;	// ???????????????90????????????
	while (true)
	{
		scanf_s("%lf,%lf", &d, &a);	// double?????????????????????%f??§????????????%lf?????????
		if (d == 0 && a == 0) { break; }
		x += cos(ak*M_PI / 180) * d;
		y += sin(ak*M_PI / 180) * d;
		ak -= a;
		ak %= 360;
	}
	// ??????
	cout << (int)x << "\n" << (int)y << endl;
	return 0;
}

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

using namespace std;

int main()
{
	double x = 0, y = 0, a, b, agl = 90, rad = 3.14159265358998 / 180;

	while(1){
		scanf("%lf,%lf", &a, &b);
		if(a == 0 && b == 0)    break;

		x += a * cos(rad * agl);
		y += a * sin(rad * agl);

		agl -= b;
	}

	cout << int(x) << endl << int(y) << endl;

	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	double PI = acos(-1.0);
	double X = 0, Y = 0;
	int angle = 90;
	while (true) {
		int x, y;char c;cin >> x >> c >> y;
		if (x == 0 && y == 0) break;
		X += x*cos(angle / 180.0 *PI);
		Y += x*sin(angle / 180.0*PI);
		angle += y;
	}
	cout << -(int)X << endl << (int)Y << endl;
}

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 <iostream> 
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
	int x,m,r=90;
	double ansX=0,ansY=0;
	char com;
	while(1){
		cin>>m>>com>>x;
		if(m==0&&x==0)break;
		ansX+=m*cos(3.1415*r/180);
		ansY+=m*sin(3.1415*r/180);
		r-=x;
	}
	cout<<(int)ansX<<endl<<(int)ansY<<endl;
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	int a, b;

	double x = 0; 
	double y = 0;
	int radius = 90;


	while (scanf("%d,%d", &a, &b), a||b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius -= b;
	}

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

C++: #include <iostream>
#include <math.h>
#include <cstdio>

using namespace std;

int main() {
    double x, y, current_angle;
    int step, angle;
    x = 0, y = 0, current_angle = 90;

    while (true) {
        scanf("%d,%d", &step, &angle);

        if (!step && !angle) {
            break;
        }

        x += step * cos(current_angle * M_PI / 180);
        y += step * sin(current_angle * M_PI / 180);
        current_angle -= angle;
    }

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

    return 0;
}

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

int main()
{
	int n,r,next=90;
	const double pi=3.14159268;
	double x=0,y=0;
	char tmp;
	while(cin>>n>>tmp>>r,n&&r)
	{
		double rad=pi/180*next;
		next+=-r;

		x+=n*cos(rad);
		y+=n*sin(rad);
	}

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

C++: #include<iostream>
#include<cmath>
using namespace std;
double a, b; int c, d; char f;
#define A(D) sin(D*0.01745329252)
#define B(D) cos(D*0.01745329252)
int main() {
	while (true) {
		cin >> c >> f >> d;
		if (c == 0 && d == 0) { break; }
		a += 1.0*A(d) * c;
		b += 1.0*B(d) * c;
	}
	cout << (int)a << endl << (int)b << endl;
}

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

int main(){
	char t;
	int d, a;
	double x = 0, y = 0, rad = M_PI/2.0;
	while(cin >> d >> t >> a){
		if(!d && !a)break;
		x += cos(rad) * (double)d;
		y += sin(rad) * (double)d;
		rad -= a / 180.0 * M_PI;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0; 
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double nx=0,ny=0,x,y,ro=0;
	while(true){
		cin>>x;cin.ignore();cin>>y;
		if(x==0&&y==0)break;
		ny+=x*sin(ro/180*M_PI);
		nx+=x*cos(ro/180*M_PI);
		ro+=y;
		//cout<<nx<<" "<<ny<<endl;
	}
	cout<<(int)nx<<endl<<(int)ny<<endl;
	return 0;
}