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 <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int a, b, r = 90;
double x = 0, y = 0;

int main() {
	while ( ~scanf( "%d,%d", &a, &b ) && a && b ) {
		x += a * cos( r * PI / 180 );
		y += a * sin( r * PI / 180 );
		r -= b;
	}
	printf( "%d\n%d\n", ( int ) x, ( int ) y );
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define R (3.1415926535898/180.0)
using namespace std;

int main(){
	int go,turn;
	double x=0,y=0,cur=0;
	
	while(scanf("%d,%d\n",&go,&turn) , (go && turn) ){
		y += cos(cur * R) * go;
		x += sin(cur * R) * go;
		cur += turn;
	}
	cout << x << endl << y << endl;
}

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

class THuman
{
public:
	void Move(int Distance);
	void Turn(int Degree);
	int GetIntegerPartX();
	int GetIntegerPartY();
	THuman();
private:
	double FX;
	double FY;
	int FDegree;
};

void THuman::Move(int Distance)
{
	FX += Distance * sin(FDegree * M_PI / 180);
	FY += Distance * cos(FDegree * M_PI / 180);
}

void THuman::Turn(int Degree)
{
	FDegree += Degree;
}

int THuman::GetIntegerPartX()
{
	double IntegerPartX;
	modf(FX, &IntegerPartX);
	return IntegerPartX;
}

int THuman::GetIntegerPartY()
{
	double IntegerPartY;
	modf(FY, &IntegerPartY);
	return IntegerPartY;
}

THuman::THuman()
{
	FX = 0;
	FY = 0;
	FDegree = 0;
}

int main()
{
	THuman Human;
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human.Move(Distance);
		Human.Turn(Degree);
	}
	cout << Human.GetIntegerPartX() << endl << Human.GetIntegerPartY() << endl;
	return 0;
}

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

int main()
{
	int x=0,y=0,tmp_y = 0;
	double X=0,Y=0;
	char dummy;
	while(cin >> x >> dummy >> y){
		if(!x && !y)break;

		X += x*cos(tmp_y*3.14159265359/180);
		Y += x*sin(tmp_y*3.14159265359/180);

		tmp_y += y;
	}

	cout << (int)Y << endl << (int)X << endl;
	cin >>x;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x = 0,y = 0,dis,ang = 90,a;
  for(;;){
    scanf("%lf,%lf",&dis,&a);
    if(dis == 0 && a == 0){break;}
    x+=dis*cos(M_PI*ang/180);
    y+=dis*sin(M_PI*ang/180);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    double x=0,y=0;
    double angle=90;
    while(true){
        double a,b;
        char c;
        cin>>a>>c>>b;
        
        if(a==0&&b==0)break;
        if(b<0){b=360+b;}
        x+=a*cos(angle*M_PI/180);
        y+=a*sin(angle*M_PI/180);
        angle-=b;
        
        
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    
    return 0;
}

C++: #include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  double a,b,x=0,y=0,s=0;
  while(scanf("%lf,%lf",&a,&b),a&&b){
    x+=a*cos(s*M_PI/180);
    y+=a*sin(s*M_PI/180);
    s+=b;
  }cout<<(int)y<<endl<<(int)x<<endl;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
#define PI (acos(-1))

int main() {
	int d,a,kakudo=0;
	long double x=0, y=0;
	while (1) {
		scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0)
			break;
		y += d*cos(kakudo*PI / 180.0);
		x += d*sin(kakudo*PI / 180.0);
		kakudo = (kakudo + a) % 360;
	}
	cout << (int)x << endl << (int)y ;
	return 0;
}