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 <math.h>

using namespace std;

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

    while (true) {
        scanf("%d,%d", &step, &angle);

        if (!step && !angle) {
            break;
        }

        x += step * cos(current_angle * M_PI / 180);
        y += step * sin(current_angle * M_PI / 180);
        current_angle -= angle;
    }

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

    return 0;
}

C++: #include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#define _USE_MATH_DEFINES

using namespace std;
int main(){
  int l,a;
  string sl,sa;
  double x,y,aa;
  x=y=aa=0;
  while(true){
  getline(cin,sl,',');
  getline(cin,sa,'\n');
  l = atoi(sl.c_str());
  a = atoi(sa.c_str());
  if (!l&&!a)break;
  x += sin(aa*(2*M_PI)/360)*l;
  y += cos(aa*(2*M_PI)/360)*l;
  aa += a;
  }
  cout << (int)x << endl << (int)y << endl;
}

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

using namespace std;
 
double degToRad(int deg) {
  return deg * M_PI / 180;
}
 
int main(void) {
  double x = 0.0, y = 0.0;
  int deg = 90;
 
  while(1) {
    int l, d;
    scanf("%d,%d", &l, &d);
    if(l == 0 && d == 0) break;
 
    x += l*cos(degToRad(deg));
    y += l*sin(degToRad(deg));
 
    deg -= d;
  }
 
  cout << (int)x << endl;
  cout << (int)y << endl;
 
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef long long ll;
typedef vector<int> vi;
typedef complex<double> P;

int main() {
	int s, t;
	P p(0.0, 0.0);
	P o(0.0, 1.0);
	while(scanf("%d,%d", &s, &t), s|t) {
		p = p + o * (double)s;
		double theta = -M_PI * t / 180.0;
		o = o * P(cos(theta), sin(theta));
	}
	printf("%d\n%d\n", (int)p.real(), (int)p.imag());
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x,y,dis,ang = 90,a;
  for(;;){
    scanf("%lf,%lf",&dis,&a);
    if(dis == 0 && a == 0){break;}
    x+=dis*cos(M_PI*2*ang/360);
    y+=dis*sin(M_PI*2*ang/360);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    std::scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  std::printf("%.0f\n%.0f\n",x,y);

}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	double x = 0, y = 0;
	double ang = 90;
	for (;;)
	{
		string str;
		cin >> str;

		stringstream ss;
		ss << str;

		double d, a;
		ss >> d;
		ss.ignore();
		ss >> a;

		double rad = ang * M_PI / 180.0;
		x += d * cos(rad);
		y += d * sin(rad);

		if (d == 0 && a == 0)
		{
			break;
		}
		ang -= a;
	}

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

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  vector<int> go;
  vector<int> rag;
  double dx,dy,K,x,y;
  int tmpgo,tmprag;
  x = 0; y =0; K = 90;
  for(int count=0;;count++){
    scanf("%d,%d",&tmpgo,&tmprag);
    go.push_back(tmpgo);
    rag.push_back(tmprag);
    if(go[count] == 0 && rag[count] == 0){
      break;
    }
    x += go[count] * cos(K*p /180);
    y += go[count] * sin(K*p /180);
    K = K - rag[count];
  }
    printf("%.0f\n%.0f\n",x,y);

}

C++: #include <iostream>
#include <cmath>
#define d2r(x) ((x)*3.14159265/180)
using namespace std;
int main()
{
	int n, t, a = 90;
	char c;
	double x = 0.0, y = 0.0;
	while (cin >> n >> c >> t, n || t)
	{
		x += n * cos(d2r((double)a));
		y += n * sin(d2r((double)a));
		a -= t;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	
	complex<double> p = (0,0);
	double ang = 90;
	while(1){
		double v_mov;
		double tmp_ang;
		char c;
		cin>> v_mov>> c>> tmp_ang;
		tmp_ang *= -1;
		if(v_mov==0 && tmp_ang==0) break;
		p.real() += v_mov * cos(ang/180*M_PI);
		p.imag() += v_mov * sin(ang/180*M_PI);
		ang += tmp_ang;
		if(ang>180)   ang -= 360;
		if(ang<=-180) ang += 360;
	}
	
	cout<< (int)p.real()<<endl;
	cout<< (int)p.imag()<<endl;

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos(-(double)pre_d*M_PI/180);
    y += -(double)a*sin(-(double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

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

using namespace std;

int main()
{
	double dis,ang;
	double nx,ny;
	double nang=pi/2.0,hang=90;
	nx=ny=0;
	while(scanf("%lf,%lf",&dis,&ang),dis){
		ny+=dis*sin(nang);
		nx+=dis*cos(nang);
		nang=(hang-ang)*pi/180;
		hang-=ang;
	}

	cout<<(int)nx<<endl<<(int)ny<<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;

int main(){

	int a,b; int c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=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.14159265

vector<int>d;
vector<int>e;


int main(){

	int a,b;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	d.push_back(a); e.push_back(b);
	}

   int n=d.size();

	int c=90; double x=0; double y=0;
    for(int i=0;i<n;i++){
	x+=d[i]*cos(c*PI/180);
	y+=d[i]*sin(c*PI/180);
	c+=-e[i];
    }

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

	return 0;
    }