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<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  double dx,dy,K,x,y;
  int tmpgo,tmprag;
  x = 0; y =0; K = 90;
  for(int count=0;;count++){
    scanf("%d,%d",&tmpgo,&tmprag);
    if(tmpgo == 0 && tmprag == 0){
      break;
    }
    x += tmpgo * cos(K*p /180);
    y += tmpgo * sin(K*p /180);
    K = K - tmprag;
  }
    printf("%.0f\n%.0f\n",x,y);

}

C++: #include<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>
#include<algorithm>

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 0;
	char kari;
	while(scanf("%lf%c%lf",&hosu,&kari,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		printf("%lf\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos += kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

int main() {
  int d, a;
  double angle = 0.0, x = 0.0, y = 0.0;
  while (true) {
    scanf("%d,%d", &d, &a);
    if (d == 0 && a == 0) break;
    double rad = angle * PI / 180.0;
    x += d * sin(rad);
    y += d * cos(rad);
    angle += a;
  }
  printf("%d\n%d\n", (int)x, (int)y);
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	int a, b;

	double x = 0; 
	double y = 0;
	int radius = 0;


	while (scanf("%d,%d", &a, &b), a||b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius += b;
	}
	y *= 10;
	int y_ = y;
	y_ %= 10;
	y_ /= 10;

	x *= 10;
	int x_ = x;
	x_ %= 10;
	x_ /= 10;

	cout << (int)y_ << endl << (int)x_ << endl;                                                        
	return 0;
}

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

double DegToRad(int);

int main(){
	char c;
	double deg=90,x,y,walk,rotate;
	while(cin>>walk>>c>>rotate){
		if( walk==0&&rotate==0 ) break;
		x+=walk*cos(DegToRad(deg));
		y+=walk*sin(DegToRad(deg));
		deg-=rotate;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	return 0;
}

double DegToRad(int deg){
	return PI*deg/180.0;
}

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

using namespace std;

int main(){
	double	x = 0,
		y = 0;
	int	deg = 0;
	int	p, q;
	while(scanf("%d,%d", &p, &q)){
		if(!p && !q) break;
		x += p * sin(deg * M_PI / 180);
		y += p * cos(deg * M_PI / 180);	
		deg += q;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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;
	prad=0;
	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 <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)

int main() {
  int d, a;
  char c;
  double x = 0.0, y = 0.0, deg = 90.0;
  while (cin >> d >> c >> a, d | a) {
    x += d * cos(deg * PI / 180.0);
    y += d * sin(deg * PI / 180.0);
    deg -= a;
  }
  cout << (int)x << "\n" << (int)y << "\n";
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double cx = 0, cy = 0;
	int angle = 90;
	for(int l, r; ~scanf(" %d,%d", &l, &r) && l && r;) {
		double rad = 3.141592653589793 * angle / 180;
		cx += l * cos(rad);
		cy += l * sin(rad);
		angle -= r;
#if 0
		cout << "before" << endl;
		cout << rad << endl;
		cout << cx << endl;
		cout << cy << endl;
		cout << "after" << endl;
#endif
	}
	printf("%d\n%d\n", (int)cx, (int)cy);
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define PI 3.141592653589793238462643383279
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<double,double> DD;

int main()
{
//	cut here before submit 
//	freopen ("testcase.TH", "r", stdin );
	string str = "";
	double dir = PI/2.;
	double x = 0., y = 0.;
	while (1 ){
		getline (cin, str );
		rep (i, str.length() ){
			if (str[i] == ',' ) str[i] = ' ';
		} // end rep
		stringstream ss (str );
		int d, t;
		ss >> d >> t;
		if (d == 0 && t == 0 ) break;
		double rot = (double)t*PI/180.;
		double dx = (double)d*cos(dir);
		double dy = (double)d*sin(dir);
		x += dx, y += dy;
		dir -= rot;
	} // end while
	printf ("%d\n%d\n", (int)x, (int)y );

	return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265358;
int main(){
  double now=90;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now/180*pi)*a;
    yy=sin(now/180*pi)*a;
    x+=xx;
    y+=yy;
    now-=(b);
    
    
    
  }  
  printf("%d\n%d\n",(int)x,(int)y);
}