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<iostream>
#include<cmath>
#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<stdio.h>
#include<math.h>
int main()
{
	int k,h;
	double x=0,y=0,mk=0;
	do{
		scanf("%d,%d",&h,&k);
		x+=sin(mk*1.0/180*atan(1.0) * 4.0)*h;
		y+=cos(mk*1.0/180*atan(1.0) * 4.0)*h;
		mk+=k;
	}while(h!=0||k!=0);
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // ??????
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // ??????
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i+1)%P.size()]

template<typename T> ostream& operator <<(ostream& r, const vector<T> t){vrep(v,t)r<<*v<<(v+1==t.end()?"":" ");return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<vector<T>, int> p){int n=p.second;minup(n,p.first.size());rep(i,n-1)r<<p.first[i]<<' ';r<<p.first[n-1];return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<T*, int> p){int n=p.second-1;rep(i,n)r<<p.first[i]<<' ';return r<<p.first[n];}
template<typename T, size_t S> ostream& operator <<(ostream& r, const T (&a)[S]){rep(i,S-1)r<<a[i]<<' ';return r<<a[S-1];}


double x, y;
vector<double> ix, iy;
double theta = 90.0;
Point res;

int main()
{
  iy.pb(theta * M_PI / 180.0);

  while(~scanf("%lf,%lf", &x, &y) && (x || y)){
    theta -= y;
    ix.pb(x);
    iy.pb(theta * M_PI / 180.0);
  }

  rep(i, ix.size()) res += polar(ix[i], iy[i]);

  printf("%d\n%d\n", static_cast<int>(res.real()), static_cast<int>(res.imag()));

  return 0;
}

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

int main() {
  int step;
  int direction;
  double x = 0;
  double y = 0;
  int dir = 90;
  while (scanf("%d,%d\n", &step, &direction) != EOF) {
    double angle = dir * 3.1415926535 / 180;
    x += step * cos(angle);
    y += step * sin(angle);
    dir -= direction;
  }
  printf("%d\n", (int)x);
  printf("%d\n", (int)y);

  return 0;
}

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

int main(){
    double x=0,y=0,met,theta,thetas=0;
    while(1){
        scanf("%lf,%lf",&met,&theta);
        if(met==0&&theta==0) break;
        x+=met*sin(thetas*M_PI/180.0);
        y+=met*cos(thetas*M_PI/180.0);
        thetas+=theta;
    }
    printf("%d\n%d\n",(int)(floor(fabs(x))*x/fabs(x)),(int)(floor(fabs(y))*y/fabs(y)));
    return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		scanf_s("%d,%d", &len, &deg);
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180.0 * M_PI);
		y += len*sin(deg_now / 180.0 * M_PI);
		deg_now += deg;
	}

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

	return 0;

}

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

int main(){
	int tx, ty;
	double x = 0, y = 0;
	double r, t, ts=0, rad;
	double pi = 3.141592653589793;
	char k;
	rad = pi / 2;
	ts = 90;
	while(1){
		cin >> r >> k >> t;
		if(r == 0 && t == 0){
			break;
		}
		x = x + r*cos(rad);
		y = y + r*sin(rad);
		ts = ts - t;
		rad = ts * pi / 180;
	}
	tx = int(x/1);
	ty = int(y/1);
	cout << tx << endl << ty << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
signed main(){
    double a,b;
	double now=0;
	double nx=0,ny=0;
	while(true){
		scanf("%lf,%lf",&a,&b);
		if(a==0&&b==0){
            cout<<(int)nx<<endl<<(int)ny<<endl;
            ggr;
        }
		nx+=a*sin(now/180*pie);
		ny+=a*cos(now/180*pie);
		now+=b;
	}
    ggr;
}

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

int main(){
	int d,a;
	double b=90,x=0,y=0;
	while(scanf("%d,%d",&d,&a),d||a){
		x+=d*cos(b/180*acos(-1.0));y+=d*sin(b/180*acos(-1.0));
		b-=a;
	}
	cout<<(int)x<<endl<<(int)y<<endl;
}

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;

int main(){

	int a,b; int c=90; double x=0; double y=0;
	while(true){

	scanf("%d,%d",&a,&b);
	if(a==0 && b==0) break;
	x+=a*cos(c*M_PI/180);
	y+=a*sin(c*M_PI/180);
	c-=b;

	}

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


	return 0;

    }

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

int main(){
	double x = 0.0, y = 0.0;
	double hosu;
	double angle = 90.0;
	double change;
	char c;
	while(cin >> hosu >> c >> change){
		if(hosu == 0 && change == 0) break;
		x += hosu * cos(angle / 180 * 3.14159);
		y += hosu * sin(angle / 180 * 3.14159);
		angle -= change;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

int main(){
	int n,r;
	double x=0. , y=0. , g=90.;
	const double PI=acos(-1);
	while(scanf("%d,%d", &n,&r) ,n||r){
		x+=n*cos(g*PI/180);
		y+=n*sin(g*PI/180);
		g-=(double)r;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0; 
}