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

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


int main(){
	double x = 0,y = 0;
	int tmp_x,tmp_y,degree=90;

	while(true){
		scanf("%d,%d",&tmp_x,&tmp_y);
		if(tmp_x == 0 && tmp_y == 0)break;
		x += tmp_x*cos(degree*M_PI/180);
		y += tmp_x*sin(degree*M_PI/180);
		degree -= tmp_y;
	}

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

    return 0;
}

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

int main() {
  
  double x=0,y=0,radian;
  int toward,deg1,deg2;
  char ch;
  
  cin >> toward >> ch >> deg1;
  y += toward;
  
  while(1){
      cin >> toward >> ch >> deg2;
      if (toward==0&&deg2==0)break;
      
      radian = acos(-1) /180  * deg1;
      x += sin(radian)*toward;
      y += cos(radian)*toward;
      deg1 += deg2;
  }
  
  cout << (int)x << endl << (int)y << endl;
  return 0;
  
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


constexpr long double pi = acos(-1L);

V<string> split(const string& s, char c) {
  V<string> res;
  stringstream ss(s);
  string t;
  while (getline(ss, t, c)) res.push_back(t);
  return res;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  long double x = 0, y = 0;
  int th = 90;
  string s;
  while (getline(cin, s)) {
    auto ss = split(s, ',');
    int d = stoi(ss[0]), a = stoi(ss[1]);
    if (d == 0) break;
    x += d * cos(th * pi / 180);
    y += d * sin(th * pi / 180);
    th -= a;
  }
  cout << static_cast<int>(x) << '\n';
  cout << static_cast<int>(y) << '\n';
}

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

double PI = 3.141592;

int main(void) {

    double x = 0;
    double y = 0;
    double r = 0;
    double a = 90;
    double d = 0;
    while(true){

        scanf("%lf,%lf", &r, &d);
        if( r == 0 && d == 0 ) break;

        x += r * cos( a * PI / 180 );
        y += r * sin( a * PI / 180 );
        cerr << x << " " << y << endl;
        a -= d;
    }
    cout << (int)x << " " << (int)y << endl;


    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a,b,x = 0,y = 0,angle = 90;
  while(scanf("%lf,%lf",&a,&b),a||b){
    x+=a*cos(angle*2*M_PI/360);
    y+=a*sin(angle*2*M_PI/360);
    angle-=b;
  }
  cout <<(int)x<<endl<<(int)y<<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 = 0;

	double aaa = sin(90);
	aaa = sin(90*M_PI / 180);

	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)y << endl << (int)x << endl;                                                        
	return 0;
}