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++: #include <iostream>
#include <math.h>
using namespace std;

int main() {

  int input1,input2;
  char c;

  int ang = 0;
  double x,y;
  x = y = 0.00;

  while(true) {

    cin >> input1 >> c >> input2;
    if ( input1 == 0 && input2 == 0 ) break;

    x += sin( M_PI * ang / 180 ) * input1;
    y += cos( M_PI * ang / 180 ) * input1;

    ang += input2;

  }

  int x_i = x;
  int y_i = y;

  cout << x_i << endl << y_i << endl;
  return 0;

}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int r, k;

  Real x = 0,
       y = 0;
  Real theta = 0;

  loop {
    char comma;
    cin >> r >> comma >> k;
    if (!r && !k) break;
    x += r * cos(theta);
    y += r * sin(theta);
    theta += k * PI / 180;
  }

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

  return 0;
}

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

int main()
{
    double x = 0.0, y = 0.0;
    const double pi = acos(-1.0);

    int prev_deg = 90;
    while (true) {
        int dist, deg;
        char comma;
        std::cin >> dist >> comma >> deg;
        if (dist == 0 && deg == 0) break;

        x += dist * cos(prev_deg * pi / 180);
        y += dist * sin(prev_deg * pi / 180);

        prev_deg -= deg;
    }

    std::cout << (int)x << "\n" << (int)y << std::endl;
}

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

int main(){
	double x,y,dx,dy,pi;
	int d,rad,prad;
	char camma;
	x=y=0;
	pi=3.141592;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos((rad+prad)*pi/180);
		dy=d*sin((rad+prad)*pi/180);
		x+=dx;
		y+=dy;
		prad=rad+prad;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	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){
		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<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define li long long int
#define ld long long double
#define PI 3.1415926535897932384626
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  double x=0,y=0;
  int a=0,b=0;
  double arg=90;
  while(1){
    scanf("%d,%d",&a,&b);
    if(a==0 && b==0)break;
    double radian=arg*PI/180.0;
    x+=a*cos(radian);
    y+=a*sin(radian);
    arg-=b;
  }
  a=x;
  b=y;
  cout<<a<<endl;
  cout<<b<<endl;
}

C++: #include <iostream>
#include <cmath>
template <class Type> class Point {
    Type x;
    Type y;
public:
    Point(const Type& f = Type(), const Type& s = Type()) : x(f), y(s) { }
    Type get_x() const { return x; }
    Type get_y() const { return y; }
    void set(const Type& x, const Type& y)  {this->x = x; this->y = y;}
    void print()  { std::cout << "(" << this->x << ", " << this->y << ")\n"; }
    void answer() { std::cout <<  static_cast<int>(this->x) << '\n' << static_cast<int>(this->y) << std::endl; }
};
int main()
{
    Point<double>   point;
    char            comma;
    for (double distance, angle, sum_angle = 0; std::cin >> distance >> comma >> angle && (distance || angle);) {
        point.set(point.get_x() + distance * sin(sum_angle), point.get_y() + distance * cos(sum_angle));
        sum_angle += angle * M_PI / 180;
    }
    point.answer();
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double X=0,Y=0;
	int degree=90;
	double DegToRad = (4.0*atan(1))/180.0;
	while(true){
		int D,A;
		scanf("%d,%d",&D,&A);
		if(D==0 && A==0) break;

		double DX=D*cos(DegToRad*degree),DY=D*sin(DegToRad*degree);
		X+=DX;
		Y+=DY;
		degree-=A;
	}

	out((ll)X);
	out((ll)Y);
	return 0;
}

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

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

int main() {
  int w;
  int cAng = 90, ang;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>ang, w != 0 && ang != 0) {
    x += w * cos(cAng*M_PI/180.0), y += w * sin(cAng*M_PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
  int w,a,ang=90;
  double x=0,y=0,r;
  while(1){
    scanf("%d,%d",&w,&a);
    if(w==0 && a==0)break;
    r=(double)ang/180.0*M_PI;
    x+=cos(r)*w;
    y+=sin(r)*w;
    ang-=a;
  }
  printf("%d\n%d",(int)x,(int)y);
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", len, rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << x <<  endl;
  cout << y << endl;
  return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int x,y,d=0;
double dx=0,dy=0;
while(cin>>x>>y,!x,!y){
dx+=cos(d)*x,dy+=sin(d)*x,d=y;
cout<<"("<<x<<","<<y<<")"<<endl;
}
}