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 <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

const double PI = 3.1415926535;

signed main(){
    double x = 0, y = 0;
    int d, a, next = 90;
    while(1){
        char c;
        cin >> d >> c >> a;
        if(d == 0 && a == 0) break;
        x += (double)d * cos(next * PI / 180.0);
        y += (double)d * sin(next * PI / 180.0);
        next -= a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
}

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

using namespace std;

double deg2rad(int degree) {
  return degree / 360.0 * 2 * M_PI;
}

int main() {
  double x = 0, y = 0;
  int length, degree;
  int direction = 90;

  while (true) {
    scanf("%d,%d", &length, &degree);
    if (length == 0 && degree == 0) { break; }

    double rad = deg2rad(direction);
    x -= length * cos(rad);
    y += length * sin(rad);

    direction += degree;
  }

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

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int d, a;
    double x = 0, y = 0;

    int angle = 90;
    while (true)
    {
        scanf("%d,%d", &d, &a);
        if (d == 0 && a == 0)
            break;
        x = x + d * cos(angle * M_PI / 180);
        y = y + d * sin(angle * M_PI / 180);

        angle -= a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

C++: #include<cstdio>
#include<cmath>
int main(){
	int w,angle;
	double x=0.0,y=0.0, prev_angle=0.0;
	while(scanf("%d,%d",&w,&angle) != EOF){
		if(w==0 && angle==0) break;
		double radian_angle = angle * M_PI / 180.0;
		x += (double)w*cos(radian_angle);
		y += (double)w*sin(radian_angle);
		
		prev_angle += (double)angle;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define R (3.1415926535898/180.0)
using namespace std;

int main(){
	int go,turn;
	double x=0,y=0,cur=0;
	
	while(scanf("%d,%d\n",&go,&turn) , (go && turn) ){
		y += cos(cur * R) * go;
		x += sin(cur * R) * go;
		cur += turn;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <complex>
#include <string>
#include <math.h>
using namespace std;
typedef complex<double> P;
const double PI = 4*atan(1.0);
 
int main(){
	P p(0, 0), dir(0,1);
	while(1){
		double d,r;
		scanf("%lf,%lf", &d, &r);
		if(d==0) break;
		p += dir*d;
		dir *= P(cos(r*PI/180), -sin(r*PI/180));
	}
	int x=p.real(), y=p.imag();
	cout << x << endl << y << endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    double x=0,y=0,theta=0;
    double a,b;
    scanf("%lf,%lf",&a,&b);
    while(a||b){
        y += a*cos(rad(theta));
        x += a*sin(rad(theta));
        theta += b;
        scanf("%lf,%lf",&a,&b);
    }
    printf("%.0lf %.0lf",x,y);
    return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>
#include <math.h>

/*****デバッグ定義*****/
//#define DEBUG
#define PI 3.14
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int walk=0,degree=0,last_degree;
	double x_ax,y_ax;
	/*****処理部*****/
	last_degree = 90;
	x_ax = 0;
	y_ax = 0;
	while(1){
		scanf("%d,%d",&walk,&degree);
		if(walk == 0 && degree == 0)	break;
		printf("%d\n%d\n",walk,degree);
		x_ax += (double)walk * cos((double)last_degree * PI / 180);
		y_ax += (double)walk * sin((double)last_degree * PI / 180);
		last_degree = last_degree - degree;
	}
	printf("%d\n%d\n",(int)x_ax,(int)y_ax);
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  double x, y;
  coor cur(0, 0);
  coor dir(1, 0);
  double pi = atan(1) * 4;
  while (scanf(" %lf,%lf ", &x, &y) == 2) {
    //printf("%.3lf\n%.3lf\n", cur.real(), cur.imag());
    if (abs(x) < EPS && abs(y) < EPS) {break;}
    cur += coor(x * dir.real(), x * dir.imag());
    double Arg = arg(dir) + (y / 180) * pi;
    dir = coor(cos(Arg), sin(Arg));
  }
  printf("%d\n%d\n", (int)cur.imag(), (int)cur.real());
  return 0;
}

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

#define PI 4*atan(1.0)

using namespace std;

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

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

	}

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

	return 0;
}

C++: #include<cstdio>
#include<cmath>
int main(){
    int hos,ang;
    int t=90;
    double x=0,y=0;
    for(;;){
        scanf("%d,%d",&hos,&ang);
        if(hos==0 && ang ==0) break;
        x+=hos*cos(t*M_PI/180);
        y+=hos*sin(t*M_PI/180);
        t-=ang;
    }
    printf("%d\n%d\n",(int)x,(int)y);
}

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

int main(void)
{
	const double PI = 6 * asin(0.5);
	double angle = 0.0;
	double x = 0.0, y = 0.0;

	while(1) {
		int dist, theta;
		scanf("%d,%d", &dist, &theta);

		if(dist == 0 && theta == 0) break;

		x += dist * sin(angle);
		y += dist * cos(angle);
		angle += (theta * PI) / 180;
	}

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

C++: #include <cstdio>
#include <cmath>
#define PI 3.14159265358979323

int correct(int d){
  if(d<0){
    return d+360;
  }else if(d>360){
    return d-360;
  }else{
    return d;
  }
}

int main(){
  double x=0,y=0;
  int l,d,dir=-90;

  while(scanf("%d,%d",&l,&d),l){
    x += l*cos(PI*dir/180);
    y += l*sin(PI*dir/180);
    dir = correct(dir+d);
  }

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