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 <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define PI 3.141592

int main(){

	int a,b; int c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*PI/180);
	y+=a*sin(c*PI/180);
	c-=b;

	}

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

	return 0;

    }

C++: #include <iostream>
#include <math.h>
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 <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


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

	while(1){
		scanf("%d,%d", &r, &ang);
		if(r == 0 && ang == 0) break;
		if(0 < ang && ang <= 90){
			x -= r * sin(M_PI*ang/180);
			y += r * cos(M_PI*ang/180);
		}else if(90 < ang && ang <= 180){
			x -= r * sin(M_PI*(180-ang)/180);
			y -= r * cos(M_PI*(180-ang)/180);
		}else if(-90 <= ang && ang < 0){
			x += r * sin(M_PI*(-ang)/180);
			y += r * cos(M_PI*(-ang)/180);
		}else{
			x += r * sin(M_PI*(180+ang)/180);
			y -= r * cos(M_PI*(180+ang)/180);
		}

	}

	cout << (int)x << endl << (int)y << 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(); //read ,
		cin >> deg;

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

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

	}

	i_x = x;
	i_y = y;

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

	return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

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

// const ll inf = INT_MAX;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	int r;
	double x=0, y=0;
	double ini = pi/2, alpha, theta;
	cout << endl;
	while(scanf("%d,%lf\n", &r, &theta)){
		if(r == 0 && std::abs(theta - 0.0) < eps){
			// printf("finished\n");
			break;
		}
		else{
			x += r*cos(ini);
			y += r*sin(ini);
			alpha = pi*theta/180;
			ini -= alpha;
		}
	}
	printf("%d %d\n", (int)x, (int)y);
	return 0;
}

C++: #include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T &a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T &a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

void print(double x){
    int t = 0;
    if(x < 0.0){
        t = ceil(x);
    }else{
        t = floor(x);
    }
    cout << t << endl;
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int d, a;
    char c;
    double x = 0.0;
    double y = 0.0;
    double kaku = M_PI * 0.5;
    while(cin >> d >> c >> a){
        x += (double)d * cos(kaku);
        y += (double)d * sin(kaku);
        kaku -= (double)a * M_PI / 180.0;
    }

    print(x);
    print(y);

    return 0;
}

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

#define pi 3.14159265

using namespace std;

int main()
{
	double dis,ang;
	double nx,ny;
	double nang=pi/2.0,hang=90;
	nx=ny=0;
	while(scanf("%lf,%lf",&dis,&ang),dis,ang){
		ny+=dis*sin(nang);
		nx+=dis*cos(nang);
		nang=(hang-ang)*pi/180;
		hang-=ang;
	}

	cout<<(int)nx<<endl<<(int)ny<<endl;
	return 0;
}

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

int main(){
	int t, n, r;
	double x, y;
	
	x = 0.0;
	y = 0.0;
	t = 90;
	while(true){
		scanf("%d,%d", &n, &r);
		if(n == 0 && r == 0){
			break;
		}
		
		x += n*cos(t*M_PI/180.0);
		y += n*sin(t*M_PI/180.0);
		t -= r;
			
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return 0;
}

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

int main(){
	int ad, angle, angle_sum = 0;
	double x = 0, y = 0;
	while(1){
		scanf("%d,%d", &ad, &angle);
		if(ad == 0 && angle == 0) break;
		x += (double)ad * sin(angle_sum * M_PI / 180.0);
		y += (double)ad * cos(angle_sum * M_PI / 180.0);
		angle_sum += angle;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0;
}

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

int main(){
    int d, t;
    double x = 0, y = 0;
    double angle = 90;
    while(1){
        cin>>d>>t;
        if(d==0&&t==0)
            break;
        x+=d*cos(angle/180*acos(-1));
        y+=d*sin(angle/180*acos(-1));
        angle-=t;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

double d, a, x, y, p;

int main() {
	while (scanf("%lf,%lf",&d,&a) && (d || a)) {
		y += d * cos(p / 180.0 * M_PI);
		x += d * sin(p / 180.0 * M_PI);
		p += a;
	}
	printf("%d\n%d\n", (int)x, (int)y);
}

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;
}