Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var x, y float64
	angle := 90.0

	for sc.Scan() {
		data := strings.Split(sc.Text(), ",")
		if data[0] == "0" && data[1] == "0" {
			break
		}
		meters, _ := strconv.Atoi(data[0])
		m := float64(meters)
		changedAngle, _ := strconv.Atoi(data[1])
		a := float64(changedAngle)

		radian := angle * math.Pi / 180
		x += m * math.Cos(radian)
		y += m * math.Sin(radian)
		angle -= a
	}
	fmt.Println(int(x))
	fmt.Println(int(y))
}

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

#define PI 3.1415926535897932386

int main()
{
	int x, r;
	double X = 0, Y = 0, rad = 90;

	while(1){
		//üÍ
		if(cin>>x)break;
		if(cin>>r)break;

		//0¾Á½çIíé
		if(x == 0 && r == 0){
			break;
		}

		X += x * cos(rad * PI/180);
		Y += x * sin(rad * PI/180);

		rad -= r;
	}
	
	X = (int)X;
	Y = (int)Y;

	cout<<X<<endl<<Y;
}

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 += sin(dir*(PI/180.0))*(double)adv;
		y += cos(dir*(PI/180.0))*(double)adv;
		dir += (double)rad;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

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

int main(){
	double x = 0;
	double y = 0;
	double theta = PI/2, kyori, yobi;
	for(int i = 0; i < 1000; i++){
		char trash;
		cin >> kyori >> trash >> yobi;
		if(kyori == 0 && yobi == 0){
			break;
		}
		yobi = yobi*PI/180;
		x = x + kyori*cos(PI-theta);
		y = y + kyori*sin(theta);
		theta = theta+yobi;
	}
	cout << (int)x << endl << (int)y << endl;
}

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

int main(void){
    
    float distance=0, angle = 0;
    float position = 90;
    float y = 0, x = 0; 
    float rad;
    
    while(1)
    {
        scanf("%f,%f", &distance, &angle);

        if(distance == 0 && angle == 0)
        {
            break;
        }
        
        rad = M_PI*(position/180);
        
        x += distance*cos(rad);
        y += distance*sin(rad);
        
        position -= angle;
        
    }
    
    
    printf("%d\n%d\n", (int)x,(int)y);
    
    return 0;
}

C++: #include<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>
#include<algorithm>

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 0;
	char kari;
	while(scanf("%lf%c%lf",&hosu,&kari,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		printf("%lf\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos += kakudo;
	}
	printf("%d\n%d\n",(int)y,(int)x);
	return 0;
}

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

using namespace std;

void Solution()
{
    int r;
    int degree;
    
    double sum = 0;
    double x = 0;
    double y = 0;
    
    char comma;
    
    while (true)
    {
        cin >> r >> comma >> degree;
        
        if (r==0 && degree==0)
        {
            break;
        }
        
        x += (double)r * sin(M_PI / 180.0 * sum); // when calculate sin, should use radian
        y += (double)r * cos(M_PI / 180.0 * sum); // when calculate cos, should use radian
        
        sum += (double)degree;
    }
    
    cout << (int)x << "\n" << (int)y << endl;
}

int main()
{
    Solution();
    return 0;
}

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

#define PI (3.141592)

int main()
{
	int hosu, angle,angleplus;
	angle = 0;
	double x = 0,y=0;
	char c;
	while( cin >> hosu >> c >> angleplus ) {
		if( hosu == 0 && angleplus == 0 )
			break;
		x += hosu * sin(angle * PI / 180 );
		y += hosu * cos(angle * PI / 180 );
		angle += angleplus;
		
	}
	printf("%d\n%d\n",(int)x,(int)y);

	return 0;
}

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

#define EPS (10e-10)
#define PI 3.1415926535

using namespace std;

double radian(int angle) {
  return (double)angle * PI / 180.0;
}

int main() {
  int a, b, num, angle = 0;
  double x = 0, y = 0;
  char s;
  while (cin >> a >> s >> b) {
    if (a == 0 && b == 0) break;
    num = a;
    y += cos(radian(angle)) * num;
    x += sin(radian(angle)) * num;
    angle += b;
  }
  cout << (int)x << endl << (int)y << endl;
  return 0;
}

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

using namespace std;

const double pi = 3.14159265358;
int main()
{
	double x = 0.0, y = 0.0, angle = 0.0;

	while(1)
	{
		double walk, turn;
		char cn;
		cin >> walk >> cn >> turn;

		if(!walk && !turn) break;

		x += walk * sin( angle * pi * ((double)1/180) );
		y += walk * cos( angle * pi * ((double)1/180) );

		angle += turn;

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

C++: #include <iostream>
#include <math.h>
#include <stdlib>
#include <cstdio>
using namespace std;
#define PI 3.14159265
int main()
{
    double x=0,y=0;
	int r,dth,th=0;
	while(true){
		scanf("%d,%d",&r,&dth);
		if(!r&&!dth)break;
		x+=r*sin((double)th*PI/180);
		y+=r*cos((double)th*PI/180);
		th+=dth;
	}
	cout<<int(x)<<endl;
	cout<<int(y)<<endl;
    return 0;
}

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

int main()
{
    int L,C,W=0;
    double x=0,y=0;
    char c;
    while(1){
        cin >> L >> c >> C;
        if(!(L||C)){
            break;
        }
        x=x+(double)L*sin(W/180.0*M_PI);
        y=y+(double)L*cos(W/180.0*M_PI);
        W+=C;
    }
    cout << x << " , " << y << endl;
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define INIT_DIR 90
#define PI 3.141592

using namespace std;


int main(){
	double dir = INIT_DIR * PI / 180;
	double moveX = 0,moveY = 0;
	int mx = 0,my = 0;
	string tmp;
	int tp = 0,tp2 = 0;

	char copy[8];

	while(cin >> tmp){
		strcpy(copy,tmp.c_str());
		tp = atoi(strtok(copy,","));
		tp2 = atoi(strtok(NULL,","));

		if(tp == 0 && tp2 == 0){
			break;
		}

		moveX += tp * cos(dir);
		moveY += tp * sin(dir);
		dir += (tp2 * PI /180) * -1;
	}

	mx = (int)moveX;
	my = (int)moveY;

	cout << mx << endl << my << endl;

	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const double EPS = 1e-6,PI = acos(-1.0);

int main()
{
	double X = 0,Y = 0;
	int A,B,R = 90;
	while(scanf("%d,%d",&A,&B) && A && B){
		X += A * cos(R * PI / 180.0);
		Y += A * sin(R * PI / 180.0);
		(R -= B) %= 180;
	}

	printf("%d\n%d\n",(int) (X + EPS),(int) (Y + EPS));

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>
#define PI 3.1415926535897932384626433832795

using namespace std;

double radian(int degree)
{
	return (PI * degree) / 180;
}

int main()
{
	double x = 0;
	double y = 0;
	int degree = 0;

	int walk, turn;
	while(true)
	{
		scanf("%d,%d", &walk, &turn);
		if(walk == 0 && turn == 0)
			break;

		x -= cos( radian(degree - 90) ) * walk;
		y -= sin( radian(degree - 90) ) * walk;
		degree -= turn;
	}

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

	return 0;
}