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 <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define INIT_DIR 90
#define PI 3.141592

using namespace std;


int main(){
	double dir = INIT_DIR * PI / 180;
	double moveX = 0,moveY = 0;
	int mx = 0,my = 0;
	string tmp;
	int tp = 0,tp2 = 0;

	char copy[8];

	while(cin >> tmp){
		strcpy(copy,tmp.c_str());
		tp = atoi(strtok(copy,","));
		tp2 = atoi(strtok(NULL,","));

		if(tp == 0 && tp2 == 0){
			break;
		}

		moveX += tp * cos(dir);
		moveY += tp * sin(dir);
		dir += tp2 * PI /180;
	}

	mx = (int)moveX;
	my = (int)moveY;

	cout << mx << endl << my << endl;

	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <complex>

using namespace std;

using Point=complex<double>;

static const double PI=3.141592653589793;

int main() {
    Point arg=polar(1.0, PI/2);
    Point target=0+0i;
    while (true) {
        double d, a;
        scanf("%lf, %lf", &d, &a);

        if (d == 0.0 && a == 0.0)
            break;

        target += d*arg;
        arg *= polar(1.0, -a*PI/180);
    }

    int x=target.real(), y=target.imag();

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

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

int main(){

  int r, deg, theta;
  double x, y, rad;

  x = 0.0;
  y = 0.0;
  theta = 0;
  rad = M_PI / 180;
  do{
    scanf("%d, %d", &r, &deg);
    if(r == 0 && deg == 0) break;
  	x += r * cos(theta * rad);
  	y += r * sin(theta * rad);
    theta = theta + deg;
  }while(1);

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

  return 0;
}

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

int main()
{
	double PI = 4 * atan(1);
	int l, t1, t2 = 0, c = 0;
	double x = 0, y = 0;
	while(scanf("%d,%d", &l, &t1) && (l != 0 || t1 != 0)){
		x += (double)l * sin(PI * (double)t2 / 180);
		y += (double)l * cos(PI * (double)t2 /180);
		t2 += t1;
	}
	cout << (int)x << " " << (int)y << endl;
}

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

int main()
{
    double x=0.0;
    double y=0.0;
    double rad = 90.0 / 180.0 * M_PI;

    while(1)
    {
        int d,a;
        scanf("%d,%d", &d, &a);
        if(d==0 && a==0)
        {
            break;
        }
        x += d * cos(rad);
        y += d * sin(rad);
        rad -= a /180.0 * M_PI; 
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

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

#define PI 3.141592653589793

using namespace std;

int main(){
    int d, a, ba=90;
    double x=0,y=0;
    while(scanf("%d,%d",&d,&a), d != 0 || a != 0){
        x += d * cos(ba * PI / 180.0);
        y += d * sin(ba * PI / 180.0);
        ba -= a;
    }
    cout << (x > 0 ? floor(x) : ceil(x)) << endl;
    cout << (y > 0 ? floor(y) : ceil(y)) << endl;

    return 0;
}

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

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

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int step,direct;
	int angle=90;
	double x=0;
	double y=0;
	while(scanf("%d,%d",&step,&direct)){
		if(!(step||direct)) break;
		x += step * cos(2*M_PI*angle/360);
		y += step * sin(2*M_PI*angle/360);
		angle -= direct;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

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

int main()
{
	int d, a;
	char s;
	double x = 0, y = 0, ap = 90, xi, yi;

	cin >> d >> s >> a;

	while (d != 0 || a != 0) {
		x += d * cos(ap / 180 * 3.14159);
		y += d * sin(ap / 180 * 3.14159);
		
		ap -= (double)a;
		
		cin >> d >> s >> a;
	}

	modf(x, &xi);
	modf(y, &yi);

	cout << xi << endl;
	cout << yi << endl;

	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef pair<int, int> paii;
typedef long long ll;

int main()
{
	complex<double> z = complex<double>(0, 0);
	double r, tht = 0, dtht;
	char c;
	
	while(cin >> r >> c >> dtht, (r||dtht))
	{
		z += polar(r, tht*acos(-1.0)/180.0);
		tht += dtht;
	}
	
	cout << (int)z.imag() << endl;
	cout << (int)z.real() << endl;
	
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

double deg,r,x=0,y=0,curdeg=0;

int main()
{
	while(true)
	{
		scanf("%lf,%lf",&r,&deg);
		if(r==0&&deg==0)
		break;
		x+=r*cos(M_PI/180*(90-curdeg));
		y+=r*sin(M_PI/180*(90-curdeg));
		curdeg+=deg;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

C++: #include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

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

	double d, a;
	char c;
	while (cin >> d >> c >> a) {
		//cout << "d:" << d << ' ' << "a:" << a << endl;

		double dx, dy;
		dx = cos(angle * PI / 180) * d;
		dy = sin(angle * PI / 180) * d;

		x += dx;
		y += dy;

		angle -= a;
	}

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

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <queue>
#include <vector>

using namespace std;

const double PI = atan(1)*4;

int main() {
  int r, d;
  double x = 0, y = 0, t = PI / 2.0;
  for (;;) {
    scanf("%d,%d", &r, &d);
    if (!r && !d) {
      printf("%d\n%d\n", int(x), int(y));
      return 0;
    }
    x += double(r) * cos(t);
    y += double(r) * sin(t);
    t -= double(d) * PI / 180.0;
  }
}

C++: /*AOJ 0016*/

#include<iostream>

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