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(){
int step,turn;
double x=0,y=0,angle;
while(scanf("%lf,%lf",&step,&turn)){
if(!step&&!turn)return 0;
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
}

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, w != 0 && ang != 0) {
    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<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
  int w,a,ang=90;
  double x=0,y=0,r;
  while(1){
    scanf("%d,%d",&w,&a);
    if(w==0 && a==0)break;
    r=(double)ang/180.0*M_PI;
    x+=cos(r)*w;
    y+=sin(r)*w;
    ang-=a;
  }
  printf("%d\n%d",(int)x,(int)y);
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", len, rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << x <<  endl;
  cout << y << endl;
  return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int x,y,d=0;
double dx=0,dy=0;
while(cin>>x>>y,!x,!y){
dx+=cos(d)*x,dy+=sin(d)*x,d=y;
cout<<"("<<x<<","<<y<<")"<<endl;
}
}

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

int main() {
	int walk, angle, na = 90;
	double x = 0, y = 0;
	char c;
	
	while(1){
		cin >> walk >> c >> angle;
		if(walk == 0 && angle == 0)break;
		
		double r = double(na / 180.0 * M_PI);
		x += walk * cos(r);
		y += walk * sin(r);
		
		na -= angle;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
int main()
{
	double x = 0, y = 0;
	int a = 90;
	while (true)
	{
		int di, ai;
		char temp;
		std::cin >> di >> temp >> ai;
		if (di == 0 && ai == 0)
		{
			break;
		}
		x += di * cos(a * M_PI / 180);
		y += di * sin(a * M_PI / 180);
		a -= ai;
	}
	std::cout << static_cast<int>(floor(x)) << std::endl;
	std::cout << static_cast<int>(floor(y)) << std::endl;
	return 0;
}

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

#define PI 3.1415926535

int main(void){
	double x=0.0,y=0.0,d,a,ang=0.0;
	int xint,yint;
	scanf("%lf,%lf",&d,&a);
	while(d!=0.0 || a!=0.0){
		x += d*sin(ang);
		y += d*cos(ang);
		a *= (PI/180);
		ang += a;
		scanf("%lf,%lf",&d,&a);
	}
	xint = x;
	yint = y;
	cout << xint << endl << yint << endl;
	return 0;
}

C++: #include <iostream>

#define M_PI 3.141592653589793

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore();
		cin >> deg;

		if(len == 0 && deg == 0) break;

		x += len * cos(direction * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		direction -= deg;
	}

	i_x = x;
	i_y = y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<cmath>
#include<iostream>
int main()
{
	double x = 0, y = 0;
	int a = 90;
	while (true)
	{
		int di, ai;
		char temp;
		std::cin >> di >> temp >> ai;
		if (di == 0 && ai == 0)
		{
			break;
		}
		x += di * cos(a * M_PI / 180);
		y += di * sin(a * M_PI / 180);
		a -= ai;
	}
	const int x_int = static_cast<int>(x >= 0 ? floor(x) : ceil(x));
	const int y_int = static_cast<int>(y >= 0 ? floor(y) : ceil(y));
	std::cout << x_int << std::endl;
	std::cout << y_int << std::endl;
	return 0;
}

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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c*3.14159265/180)*a;
		y += sin(c*3.14159265/180)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x <<' '<< y << endl;

	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
#define PI 3.141592653589793

using namespace std;

int main() {
  string str;
  int to;
  double x,y,direction,r,theta;
  x = 0;
  y = 0;
  r = 0;
  theta = 0;
  direction = 90;
  while(cin >> str) {
    to = str.find(",",0);
    r = strtol(str.substr(0,to).c_str(),NULL,10);
    theta = strtol(str.substr(to+1).c_str(),NULL,10);
    direction -= theta;
    //cout << direction << endl;
    x += r * cos(direction * PI / 180.0);
    y += r * sin(direction * PI / 180.0);
    str = "0";
  }
  cout << x << endl << y << endl;
}

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

#define PI 3.1415926535898

int main() {
	int rad, adv;
	double x=0.0, y=0.0,dir=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&adv!=0.0&&rad!=0.0) {
		x += (double)adv*sin(dir*(PI/180.0));
		y += (double)adv*cos(dir*(PI/180.0));
		dir += (double)rad;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
 
using namespace std;
 
int main(int argc, char *argv[])
{
  double x,y;
  double sumE = 0;
  double sumN = 0;
  double rad = M_PI/2.0;
  while(scanf("%lf,%lf",&x,&y) !=EOF ){
    getchar();
    if(x ==0&& y== 0)
      break;
    sumE += x*cos(rad);
    sumN += x*sin(rad);
    rad  -= y*M_PI/180;
  }
  cout <<(int)sumE <<endl<<(int)sumN <<endl;
  return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle;
while(scanf("%f,%f",&step,&turn),step,turn){
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
return 0;
}

C++: #ifndef POINT_RADIAN_H
#define POINT_RADIAN_H

#include <iostream>
#include <cmath>

using namespace std;

static const double PI = 3.141592;


class Point{
public:
    double x, y;
    Point(double x=0, double y=0): x(x),y(y){}

    Point operator + (Point p) {return Point(x+p.x, y+p.y);}
    Point operator - (Point p) {return Point(x-p.x, y-p.y);}
    Point operator * (double a) {return Point(a*x, a*y);}
    Point operator / (double a) {return Point(x/a, y/a);}

};

int main(){
    int d, a;
    int degree(0);
    Point p;
    double radian = 0;
    
    while (scanf("%d,%d",&d, &a)){
        if(d == 0 && a == 0){
            break;
        }
        radian = degree * (PI/180);
        p.x = p.x + d * cos(radian);
        p.y = p.y + d * sin(radian);
        degree += a;

    }
    cout << static_cast<int>(p.y) << "\n";
    cout << static_cast<int>(p.x) << "\n";


}


#endif // POINT_RADIAN_H

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

#define conv 0.0174532925199

using namespace std;

int main()
{
	double x=0.0,y=0.0,m,r,rad=0;
	char a;
	
	for(;;)
	{
		cin >> m >> a >> r ;
		if(m==0 && r==0)
			break;
		x+=m*sin(rad*conv);
		y+=m*cos(rad*conv);
		rad+=r;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
}