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

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

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

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

int main(){
double x,y,angle,t,r;
x=0;
y=0;
angle=M_PI/2;
while(1){
scanf("%lf,%lf",&r,&t);
if(r==0&&t==0)break;
x+=r*cos(angle);
y+=r*sin(angle);
angle+=t*M_PI/180;
}
printf("%.0f\n%.0f\n",-x,y);
return 0;
}

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

using namespace std;

int main() {
    int dest = 90;
    double x = 0;
    double y = 0;
    int d, t;

    while(scanf("%d,%d", &d, &t), d) {
        double rad = dest * M_PI / 180.0;
        x += d * cos(rad);
        y += d * sin(rad);
        dest -= t;
    }
    cout << (int) x << endl;
    cout << (int) y << endl;
}

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.14159265358;
int main(){
  double now=90;
  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/180*pi)*a;
    yy=sin(now/180*pi)*a;
    x+=xx;
    y+=yy;
    now-=(b);
    
    
    
  }  
  printf("%d %d\n",(int)x,(int)y);
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
		cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

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

double pi = acos(-1);
typedef complex<double> P;
int main(){
	int a,b;
	P p;
	P d = P(0,1);
	while( scanf("%d,%d",&a,&b) != -1 ){
		p += (1.0 * a) * d;
		d *= exp(P(0,-pi*b/180));
		
	}
	cout << (int)p.real() << "\n" << (int)p.imag() << endl;
}

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

using namespace std;

int main(){
  int d, r;
  double y = 0.0, x = 0.0, t = 90.0;
  while( scanf("%d,%d", &d, &r), d){
    y += d * sin( t / 180.0 * M_PI);
    x += d * cos( t / 180.0 * M_PI);
    t -= r;

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