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 <cstdio>
#include <cmath>

using namespace std;

int main() {
	double x = 0.0, y = 0.0;
	int deg = 90;
	while (1) {
		int r, t;
		scanf("%d,%d", &r, &t);
		if (!r&&!t)
			break;
		x += r * cos(deg*M_PI/180.0);
		y += r * sin(deg*M_PI/180.0);
		deg -= t;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	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;


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

	x *= 10;
	int x_ = x;
	x_ %= 10;
	x_ /= 10;

	cout << (int)y_ << endl << (int)x_ << endl;                                                        
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double cx = 0, cy = 0;
	int angle = 90;
	for(int l, r; ~scanf(" %d,%d", &l, &r) && l && r;) {
		double rad = 3.141592653589793 * angle / 180;
		cx += l * cos(rad);
		cy += l * sin(rad);
		angle -= r;
#if 0
		cout << "before" << endl;
		cout << rad << endl;
		cout << cx << endl;
		cout << cy << endl;
		cout << "after" << endl;
#endif
	}
	printf("%.0f\n%.0f\n", cx, cy);
	return 0;
}

C++: // #include<iostream>
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ld=long double;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c;
    int a,b;
    ld x=0, y=0;
    int deg=90;
    // cout << cosl(3.14) << endl;
    while(cin >> a>>c>>b, a|b){
      ld ar = deg*acosl(-1)/180;
      x+=a*cosl(ar);
      y+=a*sinl(ar);
      deg-=b;
    }
    cout << int(x) << endl;
    cout << int(y) << endl;
    return 0;
}

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

using namespace std;

#define PI 3.1415

int main(){

	int a,b; int c=90; float x=0; float y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*PI/180);
	y+=a*sin(c*PI/180);
	c+=-b;
	}

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

	return 0;

    }

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

int main ()
{
    double dx = 0, dy = 0, x, y, t = 90.0;
    while (scanf("%lf,%lf", &x, &y), x || y) {
        dx += x * cos(t * M_PI / 180.0);
        dy += x * sin(t * M_PI / 180.0);

        t -= y;
    }

    cout << (int)dx << endl << (int)dy << endl;

    return 0;
}

C++: #define _USE_MATH_DEFINES

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

using namespace std;

int main(){
	double x=0, y=0, r=90;//初期設定
	double d, rd;//入力値　更新部分
	char c;//ごみ
	
	while(cin>> d >> c >> rd){
		if(d==0 && rd==0) break;

		x+=d*cos(r/180*M_PI);
		y+=d*sin(r/180*M_PI);
		r-=rd;
	}

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

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	double x,y,a,b;
	int k=90,dr,dk;
	x=y=0;
	for(;;){
		scanf("%d,%d",&dr,&dk);
		if(dr==0&&dk==0)break;
		x+=dr*cos(M_PI*k/180.0);
		y+=dr*sin(M_PI*k/180.0);
		k-=dk;
	}
	modf(x,&a);
	modf(y,&b);
	printf("%d\n%d\n",(int)a,(int)b);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
    int d, r;
    double x = 0, y = 0, nr = 0;
    while( scanf("%d,%d", &d, &r), d || r ){
        double rad = nr/180*M_PI;
        x += (cos(rad)*d);
        y += (sin(rad)*d);
        nr += r;
    }
    cout << (int)y << endl;
    cout << (int)x << endl;
}

C++: //0016
// Time-stamp: <2012-07-10 18:47:25 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 <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

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

  while(cin>>w>>c>>ang) {
    if(w == 0 && ang == 0) break;
    x += w * cos(cAng*M_PI/180.0), y += w * sin(cAng*M_PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

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

using namespace std;

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

    while (true)
    {
        scanf("%d,%d", &distance, &degree);

        if (distance == 0 && degree == 0){
            break;
        }

        x += distance*cos(direction / 180 * M_PI);
        y += distance*sin(direction / 180 * M_PI);

        direction -= degree;

    }

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

    scanf("%d,%d", &distance, &degree);


    return 0;
}

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

#define PI 3.141592653589793

using namespace std;

int main(){
	int dis,deg;
	double x,y,rad;
	char con;
	x=y=0;
	rad+= 90 * PI / 180.0;;
	while(cin>>dis>>con>>deg,dis|deg){
		x+=dis*cos(rad);
		y+=dis*sin(rad);
		rad+= deg * PI / 180.0;;
	}
	cout<<-(int)x<<endl<<(int)y<<endl;
}