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

class THuman
{
public:
	void Move(int Distance);
	void Turn(int Degree);
	double GetIntegerPartX();
	double GetIntegerPartY();
	THuman();
private:
	double FX;
	double FY;
	int FDegree;
};

void THuman::Move(int Distance)
{
	FX += Distance * sin(FDegree * M_PI / 180);
	FY += Distance * cos(FDegree * M_PI / 180);
}

void THuman::Turn(int Degree)
{
	FDegree += Degree;
}

double THuman::GetIntegerPartX()
{
	double GaussX, FractionalX;
	FractionalX = modf(FX, &GaussX);
	return GaussX;
}

double THuman::GetIntegerPartY()
{
	double GaussY, FractionalY;
	FractionalY = modf(FY, &GaussY);
	return GaussY;
}

THuman::THuman()
{
	FX = 0;
	FY = 0;
	FDegree = 0;
}

int main()
{
	THuman Human;
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human.Move(Distance);
		Human.Turn(Degree);
	}
	cout << fixed << setprecision(0) << Human.GetIntegerPartX() << endl << Human.GetIntegerPartY() << endl;
	return 0;
}

C++: //0016
// Time-stamp: <2012-07-10 18:45:05 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 << (int)y << endl;

  return 0;
}

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

int main(){
	int arg = 0, a, b;
	double px, py;
	px = py = 0;
	while(scanf("%d,%d", &a, &b), a != 0 && b != 0){
		py += a * cos(arg * M_PI / 180.);
		px += (arg < 0 ? -1 : 1) * a * sin(arg * M_PI / 180.);
		arg += b;
	}
	printf("%d\n%d\n", (int)(px), (int)(py));
	return 0;
}

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

int main(void){
    int a, b, theta=90;
    double x=0.0, y=0.0;
    double PI=3.14159265358;
    while(scanf("%d,%d",&a, &b)!=EOF){
        if(a+b==0) break;
        x+=(double)a*cos(theta*PI/180);
        y+=(double)a*sin(theta*PI/180);
        theta-=b;
    }
    cout << (int)x << "\n" << (int)y << "\n";
}

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

int main(){
  double ln,cta,x=0,y=0,angle=90.0;

  while(1){

  scanf("%lf,%lf",&ln ,&cta);
  if(ln==0&&cta==0)break;

  x += ln*cos((angle/180)*M_PI);
  y += ln*sin((angle/180)*M_PI);
  angle-=cta;
  }
  cout<< x <<"\n"<< y <<endl;

  return 0;
}

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

using namespace std;

int main() {
	int dis, deg, theta=90;
	double x = 0, y = 0;
	char d;
	while (true) {
		cin >> dis >> d >> deg;
		if (dis == 0 && deg==0 ) {
			break;
		}
		else {
			x += dis * cos(theta*M_PI/180);
			y += dis * sin(theta*M_PI/180);
		}
		theta -= deg;


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

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

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

int main(){
  double x=0;
  double y=0;
  double angle=0;
  double r,th;
  while(1){
    scanf("%lf,%lf",&r,&th);
    if(r==0&&th==0)break;
    x+=r*sin(M_PI*angle/90);
    y+=r*cos(M_PI*angle/90);
    angle+=th;
  }
  printf("%d\n%d\n",(int)x,(int)y);
  return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265359;
int main(){
  double now=pi*0.5;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now)*a;
    yy=sin(now)*a;
    x+=xx;
    y+=yy;
    now-=(b);
    
    
    
    
  }  
  printf("%.0lf %.0lf\n",x,y);
}

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

#define PI 3.14159265358979323846264

using namespace std;

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

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*sin(theta*PI/180.0);
		y+=a*cos(theta*PI/180.0);

		theta+=b;
		scanf("%d,%d",&a,&b);

	}

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

	return 0;
}

C++: #include<iostream>
#include<cmath>
#define rad(x) (x * 3.141592653589793) / 180
using namespace std;

int main(void){
  int m, n;
  int ansx,ansy;
  char chr;
  double x = 0, y = 0, a = 90.0;

  while(cin >> m >> chr >> n , m != 0 || n != 0){
    x += cos(rad(a)) * m;
    y += sin(rad(a)) * m;
    a -= n;
    if(a < 0)
      a += 360;
    if(a >= 360)
      a -= 360;
  }
  
  ansx = x;
  ansy = y;
  cout << ansx << endl << ansy << endl;
  return 0;
}

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

int main(){
	int arg = 0, a, b;
	double px, py;
	px = py = 0;
	while(scanf("%d,%d", &a, &b), a != 0 && b != 0){
		py += a * cos(arg * M_PI / 180.);
		px += (arg < 0 ? -1 : 1) * a * sin(arg * M_PI / 180.);
		arg += b;
		printf("%f %f\n", px, py);
	}
	printf("%d\n%d\n", (int)(px), (int)(py));
	return 0;
}