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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double cx = 0, cy = 0;
	int angle = 90;
	for(int l, r; scanf("%d,%d", &l, &r) && l && r;) {
		double rad = angle * PI / 180.0;
		cx += l * cos(rad);
		cy += l * sin(rad);
		angle += r;
#if 0
		cout << "before" << endl;
		cout << rad << endl;
		cout << cx << endl;
		cout << cy << endl;
		cout << "after" << endl;
#endif
	}
	printf("%d\n%d\n", (int)cx, (int)cy);
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define PI acos(-1)
using namespace std;
int main(){
double x=0,y=0,ka=PI/2;
int ho,kai;
char d;
while(cin>>ho>>d>>kai,ho||kai){
x+=ho*cos(ka);
y+=ho*sin(ka);
ka-=PI/180*kai;
}
//cout<<(double)sin(0)<<endl;
cout<<(int)x<<endl<<(int)y<<endl;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int a,b,theta=90;
    double x=0,y=0,pi=3.141592653589;
    char k;
    for(;;){
        scanf("%d,%d",&a,&b);
        if(a==0 && b==0){
            break;
        }
        y+=a*sin(theta/180.0*pi);
        x+=a*cos(theta/180.0*pi);
        theta+=b;
    }
    printf("%d\n%d\n",(int)-x,(int)y);
    return 0;
}

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

int main(){
  int l,theta_in,theta = 90;
  double x = 0, y = 0;
  char k;
  double pi = atan(1)*4;
  while(cin >> l >> k >> theta_in,l||theta_in){
	x += l*cos(theta*pi/180); 
	y += l*sin(theta*pi/180);
	theta -= theta_in;
  }
  cout << (int) x << endl
	   << (int) y << endl;
  return 0;
}

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

int main(void)
{
    int d, t;
    char c;
    double x = 0.0, y = 0.0, r = 0.0;
    while(cin >> d >> c >> t) {
        if (d == 0 && t == 0)
            break;
        y += d * cos(r / 180 * M_PI);
        x += d * sin(r / 180 * M_PI);
        r += t;
    }

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

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

constexpr auto PI = 3.14159265358979323846264338;

auto main () -> int
{
    int d , t;
    double x = 0 , y = 0;
    int angle = 0;
    while (std::scanf ("%d,%d" , & d , & t) == 2 && (d || t))
    {
        x += d * std::sin (angle * PI / 180.0);
        y += d * std::cos (angle * PI / 180.0);
        angle += t;
    }
    std::cout << static_cast <int> (x) << std::endl;
    std::cout << static_cast <int> (y) << std::endl;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>
#include <math.h>

/*****デバッグ定義*****/
//#define DEBUG
#define PI 3.14
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int walk=0,degree=0,last_degree;
	double x_ax,y_ax;
	/*****処理部*****/
	last_degree = 90;
	x_ax = 0;
	y_ax = 0;
	while(1){
		scanf("%d,%d",&walk,&degree);
		if(walk == 0 && degree == 0)	break;
		//printf("%d\n%d\n",walk,degree);
		x_ax += (double)walk * cos((double)last_degree * PI / 180);
		y_ax += (double)walk * sin((double)last_degree * PI / 180);
		last_degree = last_degree - degree;
	}
	printf("%d\n%d\n",(int)x_ax,(int)y_ax);
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	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 * sin(radian);
        p.y = p.y + d * cos(radian);
        degree += a;

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


}


#endif // POINT_RADIAN_H

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

#define PI 3.14159265358979323

int main(void)
{
  double deg = 30;
  double ang = 90;
  double len = 2;
  double ansx = 0, ansy = 0;
  while (1) {
    scanf("%lf,%lf", &len, &deg);
	if (len == 0 && deg == 0)
		break;
    double rad = ang * PI / 180.0;
    double x = len * cos( rad );
    double y = len * sin( rad );
	ang = ang - deg;
//    printf( "X=%f Y=%f\n", x, y );
	ansx = ansx + x;
	ansy = ansy + y;
  }
  printf( "%.0f\n%.0f\n", floor(ansx), ansy );

  return 0;
}

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


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r;
	while (d != 0 || r != 0) {
		cin >> d >> r;
		x = x + d * cos(a / 2 / pi);
		y = y + d * sin(a / 2 / pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}

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

#define Pai 3.141592653589793
int main(void)
{
	double x=0,y=0,l=90,n,m;
	
	while(1){
		scanf("%lf,%lf",&n,&m);
		if (n==0&&m==0) {
			break;
		}
		y+=n*sin((double)l*Pai/180);
		x+=n*cos((double)l*Pai/180);
		l-=m;
	}
	printf("%.0f\n%.0f\n",x,y);
	
	return (0);
}