Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

C++: //Aizu - 0016 : Treasure Hunt
#include<stdio.h>
#include<math.h>

const double PI = acos(-1.0);
const double eps = 1e-8;

int main()
{
	double d,t;
	double x=0,y=0;
    double dir = 0.0;
	while(scanf("%lf%*c%lf",&d,&t)&&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
	    while(dir - 360 > -eps) dir -= 360;
	    while(dir < -eps) dir += 360;
		x += d*sin((dir) / 180.0 * PI);						//隶。邂?		y += d*cos((dir) / 180.0 * PI);
	    dir += t;
	}
    int ox, oy;
    ox = x, oy = y;
	printf("%d\n%d\n", ox, oy);					//霎灘?

	return 0;
}

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

int main(void){
    double x=0;
    double y=0;
    double angle=90;
    int d,a;
    while(1){
        scanf("%d,%d",&d,&a);
        if(d==0 && a==0){
            printf("%d\n%d\n",(int)x,(int)y);
            return 0;
        }
        x+=d*cos(angle*2*M_PI/360);
        y+=d*sin(angle*2*M_PI/360);
        angle-=a;
    }

}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main(){
	int step,dir;
	double x=0.0, y=0.0, angle=0.0;
	
	while(1){
		scanf("%d,%d", &step, &dir);
		if(step==0 && dir==0) break;
		x += (double)(step) * sin( angle*ANGLE );
		y += (double)(step) * cos( angle*ANGLE );
		angle += (double)dir;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	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;
	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\n", (int)x);
	printf("%d\n", (int)y);
	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 * -1;
	my = (int)moveY;

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

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
signed main(){
        int a,b;
        float x=0,y=0;
        int d=90;
        while( scanf("%lld,%lld", &a, &b) != EOF ){
                if(a==0&&b==0) break;
                x+=a*cos(d/180.0*M_PI);
                y+=a*sin(d/180.0*M_PI);
                d-=b;
        }
        printf("%.0f\n%.0f\n",x,y);
        return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#define PI 3.14159265358

using namespace std;

int main(void){

  int go,kakudo;
  char ten;
  double x,y;
  int R = 90;
  x = y = 0;
  while(1){
    cin >> go >> ten >> kakudo;
    if( go == 0 && kakudo == 0 )break;
    x += go * sin(R*PI/180);
    y += go * cos(R*PI/180);
    R -= kakudo;
  }
  printf("%d\n%d\n", (int)y, (int)x);  
  return 0;
}

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

const double PI = 3.141592653589;

int main()
{
	int len,deg;
	double x,y,deg_sum;
	x = 0;
	y = 0;
	deg_sum = 0;
	scanf("%d,%d",&len, &deg);
	while(len != 0 || deg != 0){
		x += sin(deg_sum * PI / 180) * (double)len;
		y += cos(deg_sum * PI / 180) * (double)len;
		deg_sum += (double)deg;
		scanf("%d,%d",&len, &deg);
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

int main(void)
{
	float len;
	float ang, angin;
	float x, y;
	
	x = 0;
	y = 0;
	ang = 90;
	while (1){
		scanf("%f %f", &len, &angin);
		
		if (len == 0 && angin == 0){
			break;
		}
		
		y += (sin(ang / 180 * M_PI) * len);
		x += (cos(ang / 180 * M_PI) * len);
		
		ang -= angin;
	}
	
	printf("%.0f\n%.0f\n", x, y);
	
	return (0);
}

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

using namespace std;


int main(){
	double x,y,s;
	int n,k;
	
	
	x=y=s=0;
	while((scanf("%d,%d",&n,&k)),n!=0){
		x=x+n*cos(M_PI*s/180);
		y=y+n*sin(M_PI*s/180);
		s=s+k;
	}
	printf("%d\n%d\n",int(y),int(x));
}

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