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 <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
	int dir=0, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d, %d\n",adv,rad)) {
		if (adv==0&&rad==0) break;
		dir += rad;
		x += cos(dir)*adv;
		y += sin(dir)*adv;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d",x,y);
}

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

#define PI 3.14159265359

int main() {
	double coor[3] = { 0,0,90 };
	int length, angle;
	while (1) {
		scanf("%d,%d", &length, &angle);
		if (length == 0 && angle == 0)break;
		coor[0] += (double)length * cos((double)coor[2] * PI / 180);
		coor[1] += (double)length * sin((double)coor[2] * PI / 180);
		coor[2] -= angle;
	}
	printf("%d\n%d\n", (int)coor[0], (int)coor[1]);
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#define PI 3.1415926535897932384626433
using namespace std;
int main(){
    double nowx=0,nowy=0,nowkaku=PI/2;
    while(1){
        double ho,kaku;
        scanf("%lf,%lf",&ho,&kaku);
        if(ho==0&&kaku==0)break;
        nowy+=sin(nowkaku)*ho;
        nowx+=cos(nowkaku)*ho;
        nowkaku+=PI/180*kaku;
    }
    printf("%d\n%d\n",(int)nowx,(int)nowy);
    return 0;
}

C++: #include<iostream>
#include<math>

#define conv 0.0174532925199

using namespace std;

int main()
{
	double x=0.0,y=0.0,m,r,rad=0;
	char a;
	
	for(;;)
	{
		cin >> m >> a >> r ;
		if(m==0 && r==0)
			break;
		x+=m*sin(rad*conv);
		y+=m*cos(rad*conv);
		rad+=r;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,r;
	double x=0. , y=0. , g=90.;
	const double PI=acos(-1);
	while(scanf("%d,%d", &n,&r) ,n||r){
		x+=n*cos(g*PI/180);
		y+=n*sin(g*PI/180);
		g-=(double)r;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0; 
}

C++: //0016
// Time-stamp: <2012-07-10 18:48:35 naga>

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define PI 3.1415926535
using namespace std;


int main(){
  int walk, deg;
  double x, y;
  int direction;

  x = y = 0;
  direction = 90;
  while(true){
    //radian = (double)(direction * PI/ 180);
    scanf("%d,%d", &walk, &deg);
    if(!walk && !deg){
      break;
    }
    
    x += (double)walk * cos(direction * PI / 180);
    y += (double)walk * sin(direction * PI / 180);

    // 向きを変える。角度を360以下に
    direction += deg;
    if(direction > 360){
      direction = direction - 360;
    }
  }

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

  return 0;
}

C++: #include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    double x=0,y=0,met,theta,thetas=0,pi=3.1415926535897;
    while(1){
        scanf("%lf,%lf",&met,&theta);
        if(met==0&&theta==0) break;
        x+=met*sin(thetas*pi/180.0);
        y+=met*cos(thetas*pi/180.0);
        thetas+=theta;
    }
    printf("%d\n%d\n",(int)(floor(fabs(x))*x/fabs(x)),(int)(floor(fabs(y))*y/fabs(y)));
    return 0;
}

C++: /*AOJ 0016*/

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

#define M_PI 3.14159265

using namespace std;

double changeDegToRad(double deg){

	return deg*M_PI/180.0;

}

int main(){

	double x = 0,y = 0;
	double deg = 0,walk = 0;
	double rad = M_PI/2.0;
	while(1){
		scanf("%lf,%lf",&walk,&deg);


		if(deg==0&&walk==0){
			break;
		}

		x += walk * cos(rad);
		y += walk * sin(rad);

		rad -= changeDegToRad(deg);

	}

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

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#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* M_PI / 180);
		y += len*sin(deg_now* M_PI / 180);
		deg_now -= deg;
	}

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

	return 0;

}

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

double pi = 3.14159;

int main(void) {
    int a, b;
    double rad = 0.0;
    double x = 0;
    double y = 0;
    
    do {
        scanf("%d,%d", &a, &b);
        x += a * sin((rad/180) * pi);
        y += a * cos((rad/180) * pi);
        rad += b;
    }while(!(a == 0 && b == 0));
    cout << (int)x << endl
         << (int)y << endl;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int d, a;
  double x = 0, y = 0, degree = 90;
  char c;
  while (cin >> d >> c >> a, d != 0 || a != 0) {
    x += d * cos(degree / 180 * M_PI);
    y += d * sin(degree / 180 * M_PI);
    degree -= a;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

double x = 0;
double y = 0;

int main() {
	double dir = M_PI/2;
	double d, t;
	// dump(sin(M_PI));
	// dump(cos(dir));
	// dump(sin(dir));
	while (scanf("%lf,%lf",&d,&t) != EOF) {
		cout << d << " " << t << endl;
		if (d == 0) break;
		x += d*cos(dir);
		y += d*sin(dir);
		dir += -t/180*M_PI;
	}
	cout << (ll)(x+1e-8) << endl;
	cout << (ll)(y+1e-8) << endl;
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	double x, y;
	int currentAngle = 0;
	string buffer;


	while ( true )
	{
		cin >> buffer;

		for ( unsigned int i = 0; i < buffer.size(); i++ )
		{
			if ( buffer[i] == ',' )
			{
				buffer[i] = ' ';
				break;
			}
		}

		int pedometer, angle;

		istringstream is( buffer );
		is >> pedometer >> angle;

		if ( pedometer == 0 && angle == 0 )
		{
			break;
		}

		x += sin( currentAngle * M_PI / 180 ) * pedometer;
		y += cos( currentAngle * M_PI / 180 ) * pedometer;
		currentAngle += angle;
	}

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

	return 0;
}