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 <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    double x=0,y=0;
    double r = 90;
    while(1){
        int d,a;
        scanf("%d,%d",&d,&a);
        if(d==0 && a==0) break;

        double dy = d * sin(r / 180.0 * M_PI);
        double dx = d * cos(r / 180.0 * M_PI);

        //cout << r << " " << dx << " " << dy << endl;

        x += dx;
        y += dy;

        r -= a;
    }
    printf("%d\n",(int)x);
    printf("%d\n",(int)y);
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
int i,j;
char c;
double x,y,a,pi=3.1415926;
x=y=0;a=90*pi/180;
while(1){
cin>>i>>c>>j;
if(i==0&&j==0)break;
x+=i*cos(a);
y+=i*sin(a);
a+=j*pi/180;
}
cout<<trunc(x)<<endl;
cout<<trunc(y)<<endl;
return 0;
}

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

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

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

	return 0;
}

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

using namespace std;

using Point=complex<double>;

static const double PI=3.141592653589793;

int main() {
    Point arg=polar(1.0, PI/2);
    Point target=0+0i;
    while (true) {
        double d, a;
        scanf("%lf, %lf", &d, &a);

        if (d == 0.0 && a == 0.0)
            break;

        target += d*arg;
        arg *= polar(1.0, -a*PI/180);
    }

    int x=target.real(), y=target.imag();

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

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

int main(){

  int r, deg, theta;
  double x, y, rad;

  x = 0.0;
  y = 0.0;
  theta = 0;
  rad = M_PI / 180;
  do{
    scanf("%d, %d", &r, &deg);
    if(r == 0 && deg == 0) break;
  	x += r * cos(theta * rad);
  	y += r * sin(theta * rad);
    theta = theta + deg;
  }while(1);

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

  return 0;
}

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

int main()
{
	double PI = 4 * atan(1);
	int l, t1, t2 = 0, c = 0;
	double x = 0, y = 0;
	while(scanf("%d,%d", &l, &t1) && (l != 0 || t1 != 0)){
		x += (double)l * sin(PI * (double)t2 / 180);
		y += (double)l * cos(PI * (double)t2 /180);
		t2 += t1;
	}
	cout << (int)x << " " << (int)y << endl;
}

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

int main()
{
    double x=0.0;
    double y=0.0;
    double rad = 90.0 / 180.0 * M_PI;

    while(1)
    {
        int d,a;
        scanf("%d,%d", &d, &a);
        if(d==0 && a==0)
        {
            break;
        }
        x += d * cos(rad);
        y += d * sin(rad);
        rad -= a /180.0 * M_PI; 
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

C++: #include<bits/stdc++.h>

#define PI 3.141592653589793

using namespace std;

int main(){
    int d, a, ba=90;
    double x=0,y=0;
    while(scanf("%d,%d",&d,&a), d != 0 || a != 0){
        x += d * cos(ba * PI / 180.0);
        y += d * sin(ba * PI / 180.0);
        ba -= a;
    }
    cout << (x > 0 ? floor(x) : ceil(x)) << endl;
    cout << (y > 0 ? floor(y) : ceil(y)) << endl;

    return 0;
}

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

int main(void)
{
    int m, d;
    char c;
    double x = 0; 
    double y = 0;
    double cur_d = M_PI / 2.0;
    while (cin >> m >> c >> d) {
        if (m == 0 && d == 0) break;
        x += cos(cur_d) * m;
        y += sin(cur_d) * m;
        cur_d -= d * M_PI / 180.0;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int step,direct;
	int angle=90;
	double x=0;
	double y=0;
	while(scanf("%d,%d",&step,&direct)){
		if(!(step||direct)) break;
		x += step * cos(2*M_PI*angle/360);
		y += step * sin(2*M_PI*angle/360);
		angle -= direct;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

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

int main()
{
	int d, a;
	char s;
	double x = 0, y = 0, ap = 90, xi, yi;

	cin >> d >> s >> a;

	while (d != 0 || a != 0) {
		x += d * cos(ap / 180 * 3.14159);
		y += d * sin(ap / 180 * 3.14159);
		
		ap -= (double)a;
		
		cin >> d >> s >> a;
	}

	modf(x, &xi);
	modf(y, &yi);

	cout << xi << endl;
	cout << yi << endl;

	return 0;
}