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<algorithm>
#include<math.h>
#define P 3.141592653589793
using namespace std;

double Y(int z){
	if(z==0||z==180)return 0.0;
	if(z<180)return sin(P/180*z);
	return -sin(P/180*(360-z));
}
double X(int z){
	if(z==90||z==270)return 0.0;
	if(z<180)return cos(P/180*z);
	return cos(P/180*(360-z));
}
int main(){
	double x=0,y=0;
	int z=90,a,b;char u;
	while(cin>>a>>u>>b&&a+b){
		y+=a*Y(z),x+=a*X(z);
		z-=b;z%=360;if(z<0)z+=360;
	}
	int xx=x,yy=y;
	cout<<xx<<endl;
	cout<<yy<<endl;
	return 0;
}

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

int main(){
    double x=0,y=0,met,theta,thetas=0;
    while(1){
        scanf("%lf,%lf",&met,&theta);
        if(met==0&&theta==0) break;
        x+=met*sin(thetas*M_PI/180.0);
        y+=met*cos(thetas*M_PI/180.0);
        thetas+=theta;
    }
    printf("%d\n%d\n",(int)(floor(fabs(x))*x/fabs(x)),(int)(floor(fabs(y))*y/fabs(y)));
    return 0;
}

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

double cos(double x){
	double c = 0.0;
	double y = 1.0;
	double n = 1;
	for(int i = 1; i < 30; i++){
		c += y / n;
		y = - y * x * x;
		n = 2 * i * (2 * i - 1) * n;
	}
	return c;
}

double sin(double x){
	double s = 0.0;
	double y = x;
	double n = 1;
	for(int i = 1; i < 30; i++){
		s += y / n;
		y = - y * x * x;
		n = 2 * i * (2 * i + 1) * n;
	}
	return s;
}

int main(){
	double x = 0.0, y = 0.0;
	double hosu;
	double angle = 90.0;
	double change;
	char c;
	while(cin >> hosu >> c >> change){
		if(hosu == 0 && change == 0) break;
		x += hosu * cos(angle / 180 * 3.14159);
		y += hosu * sin(angle / 180 * 3.14159);
		angle -= change;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

double setX(double r, double d)
{
	return r*cos(M_PI/2-d);
}

double setY(double r, double d)
{
	return r*sin(d+M_PI/2);
}

int main (void)
{
	double x=0.0, y=0.0, r=0.0, d=0.0, old_d=0;
	
	do
	{
		scanf("%lf,%lf", &r, &d);
		x+=setX(r, old_d);
		y+=setY(r, old_d);
		old_d+=d*M_PI/180;
	}while(r && d);
	
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

int main()
{
    double x = 0;
    double y = 0;
    double a = M_PI_2;
    while(true){
        int d, t;
        char c;
        std::cin >> d >> c >> t;
        if(d == 0 && t == 0) break;
        x += d * std::cos(a);
        y += d * std::sin(a);
        a += (-t * M_PI / 180);
    }
    std::cout << std::floor(x) << std::endl;
    std::cout << std::floor(y) << std::endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
using namespace std;
#define PI 3.141592
int main(){
  float angle;
  float x=0,y=0;
  float d,t;
  string str;
  cin >> str;
  if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else t = (str[2]-'0')*10+(str[3]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else t = (str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else t = (str[4]-'0')*10+(str[5]-'0');
    }
  }
  while(d!=0||t!=0){
    x+=d*sin(angle/180*PI);y+=d*cos(angle/180*PI);
    angle+=t;
    //if(angle>360) angle-=360;
    //if(angle<-360) angle+=360;
    
    
    cin >> str;
    if(str[1]==','){
      d= str[0]-'0';
      if(str[2]=='-'){
	if(str.size()==4) t = (str[3]-'0')*(-1);
	else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      }else{
	if(str.size()==3) t = str[2]-'0';
	else t = (str[2]-'0')*10+(str[3]-'0');
      }
    }else if(str[2]==','){
      d= (str[0]-'0')*10+str[1]-'0';
      if(str[3]=='-'){
	if(str.size()==5) t = (str[4]-'0')*(-1);
	else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
	if(str.size()==4) t = str[3]-'0';
	else t = (str[3]-'0')*10+(str[4]-'0');
      }
    }else if(str[3]==','){
      d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
      if(str[4]=='-'){
	if(str.size()==6) t = (str[5]-'0')*(-1);
	else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      }else{
	if(str.size()==5) t = str[4]-'0';
	else t = (str[4]-'0')*10+(str[5]-'0');
      }
    }
  }
  int x1=x,y1=y;
  printf("%d\n%d\n",x1,y1);
  return 0;
}

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

using namespace std;

typedef complex<double> Point;

int main() {
    Point pos(0, 0);
    Point unit(0, 1);
    while(true) {
        int r, a;
        char c;
        cin >> r >> c >> a;
        if(r == 0 && a == 0) break;

        pos += unit * (double)r;
        unit *= polar(1.0, -M_PI*a/180);
    }
    cout << (int)pos.real() << endl;
    cout << (int)pos.imag() << endl;
    return 0;
}

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

int main(){
  double x, y, r;
  x = y = 0;
  r = -M_PI/2;
  while(1){
    int n,m;
    scanf("%d,%d", &n, &m);
    if(n==0&&m==0) break;

    x += n*cos(r);
    y += n*sin(r);
    r -= m*M_PI/180;
  }
  printf("%d\n%d\n", (int)x*-1,(int)y*-1);
}

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

using namespace std;

template <typename T, int N>
int ArraySize(const T(&)[N]) {
    return N;
}


int main() {
    constexpr double Pi = 3.1415926535;

    long double x {}, y {}, radianAngle {Pi / 2.0};
    
    char c;

    for(int steps, rotate, currentRotation{90}; cin >> steps >> c >> rotate;) {
        if(steps == 0 && rotate == 0) break;


        x += steps * cos(radianAngle);
        y += steps * sin(radianAngle);

        currentRotation += -rotate < 0 ? -rotate : 360 - rotate;
        radianAngle = 2 * Pi * currentRotation / 360;

    }

    

    std::cout << static_cast<int>(x) << '\n' << static_cast<int>(y) << endl;

    return 0;
}

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

constexpr double pi = 3.141593;

int main() {
	double pos_x = 0;
	double pos_y = 0;
	int degree = 0;
	
	while (true) {
		int norm, deg;
		std::scanf("%d,%d", &norm, &deg);
		if (norm == 0 && deg == 0) {
			break;
		}
		
		double theta = degree * pi / 180.0;
		pos_y += norm * std::sin(theta);
		pos_x += norm * std::cos(theta);
		degree += deg;
	}
	
	std::cout << static_cast<int>(pos_y) << std::endl;
	std::cout << static_cast<int>(pos_x) << std::endl;
}

C++: import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 


print("{:.0f}".format(ystep))
print("{:.0f}".format(xstep))