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<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

const double EPS = 0.1;

int main(){
	
	int a,b;
	double angle = M_PI/2;
	P pos = P(0,0);
	
	while(scanf("%d,%d",&a,&b)){
		if(a==0 && b==0)break;
		pos += P(cos(angle),sin(angle))*(double)a;
		angle -= b/180.0*M_PI;
	}
	
	printf("%d\n%d\n",(int)pos.X,(int)pos.Y);
}

C++: #include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
#define  PI 3.141592
int main(void){
    long double x=0.0, y=0.0;
    int distance, angle, angle_total=0;
    char commma;
    
   
    while(1){
        cin >> distance>> commma >> angle;
        if(angle == 0 && distance == 0) break;
        x += distance * cos((90-angle_total)*PI/180);
        y += distance * sin((90-angle_total)*PI/180);
        angle_total += angle;
        


    }
    int int_x = x;
    int int_y = y;
    cout <<  int_x << endl << int_y << endl;
    return 0;
}

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

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 90;
	while(scanf("%lf,%lf",&hosu,&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)x,(int)y);
	return 0;
}

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

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

	int l, a;

	while(scanf("%d,%d",&l,&a) + 1){
		x += l * cos(a * PI / 180);
		y += l * sin(a * PI / 180);
	}

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

	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle=0;
while(1){
scanf("%d,%d",&step,&turn);
if(!step&&!turn)break;
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++: #include <iostream>
#include <cstdio>
#include <complex>
#define _USE_MATH_DEFFINES
#include <cmath>
using namespace std;
typedef complex<double> P;

double convert(double angle) {
    return((M_PI * (angle / 180.0)));
}

P now(0, 0);
double angle = 0;

int main(void) {
    int fd, spin;
    
    while(scanf("%d,%d", &fd, &spin), fd + spin != 0) {
        double nextx = now.real() + fd * sin(convert(angle)),
        nexty = now.imag() + fd * cos(convert(angle));
        now = P(nextx, nexty);
        angle += spin;
    }
    cout << (int)now.imag() << endl << (int)now.real() << endl;
    return(0);
}

C++: #include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#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<string>
#include<algorithm>
#include<cmath>
using namespace std;


int main(){
  int n;
  int a,b;
  char c;

  double x=0.0, y=0.0;
  int angle=90;

  // cout << M_PI << endl;
  
  while(cin >> a >> c >> b){
    // cout << "---" << endl;
    // cout << a << endl;
    // cout << b << endl;
    if(a==0 && b==0){
      break;
    }
    x += a*cos(angle*M_PI/180.0);
    y += a*sin(angle*M_PI/180.0);
    angle -= b;
    
    if(angle <= -180){
      angle += 360;
    }
    if(angle >= 180){
      angle -= 360;
    }
  }

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

C++: #include <iostream>
#include <cmath>
#define PI acos(-1)
 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=PI/2.0;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr);
                y+=l*sin(nr);
                nr-=r*PI/180.0;
        }
        cout << (int)x <<endl<< (int)y <<  endl;
return 0;
}

C++: #include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x) cerr << "  (L" << __LINE__ << ") " << #x << " = " << (x) << endl;
#define dumpv(x) cerr << "  (L" << __LINE__ << ") " << #x << " = "; REP(q,(x).size()) cerr << (x)[q] << " "; cerr << endl;
template<typename T1, typename T2>
ostream& operator<<(ostream& s, const pair<T1, T2>& d) {return s << "(" << d.first << "," << d.second << ")";}


int main() {
  double x = 0.0, y = 0.0;
  double angle = 90;

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

    double theta = PI * angle / 180.0;
    x += a * cos(theta);
    y += a * sin(theta);
    angle -= b;
  }

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

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

int main() {
	double x=0, y=0, a, b, now = 90;
	char c;
	while (cin >> a >> c >> b, a || b) {
		x += a * cos(M_PI * now / 180);
		y += a * sin(M_PI * now / 180);
		now = now - b;
	}
	if (x >= 0) x = floor(x);
	else if (x < 0) x = ceil(x);
	if (y >= 0) y = floor(y);
	else if (y < 0) y = ceil(y);
		cout << x << endl;
		cout << y << endl;
}

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


double rad(int degree){
	return (M_PI*degree) / 180;
}


int main(){
	double x = 0, y = 0;
	int d, dir = 90, a;
	char comma;

	while (cin >> d >> comma >> a, d || a){
		x += d * cos(rad(dir));
		y += d * sin(rad(dir));
		dir -= a;
	}

	cout << (int)x << endl;
	cout << (int)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;
	}
	std::cout << static_cast<int>(floor(x)) << std::endl;
	std::cout << static_cast<int>(floor(y)) << std::endl;
	return 0;
}