Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x, y := 0.0, 0.0
	rotate := 90.0

	for {
		line := nextString()
		if line == "0,0" {
			break
		}

		numbers := strings.Split(line, ",")
		di, _ := strconv.ParseFloat(numbers[0], 64)
		ai, _ := strconv.ParseFloat(numbers[1], 64)

		rotateRadian := math.Pi * rotate / 180.0
		x += di * math.Cos(rotateRadian)
		y += di * math.Sin(rotateRadian)

		rotate -= ai

		// fmt.Println(x, y)
	}

	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main(void)
{
	int i=0,a,b,k=90;
	double x=0,y=0;

	while(i == 0)
	{
		scanf("%d,%d",&a,&b);

		if(a == 0 || b == 0)break;

		x += cos(k * M_PI / 180)*a;
		y += sin(k * M_PI / 180)*a;
		k -= b;
	}
  printf("%d\n%d\n",(int)x,(int)y);

  return 0;
}

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

int main()
{
	char c;
	int d, a;
	ld x = 0, y = 0;
	int deg = 90;
	while (cin >> d >> c >> a) {
		ld ar = deg * acosl(-1) / 180;
		x += d * cosl(ar);
		y += d * sinl(ar);
		deg -= a;
	}
	cout << (int)x << ' ' << (int)y << endl;
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
 
int main(void)
{
    int d, t;
    char c;
    double x = 0.0, y = 0.0, r = 0.0;
    while(cin >> d >> c >> t) {
        if (d == 0 && t == 0)
            break;
        y += d * cos(r / 180 * M_PI);
        x += d * sin(r / 180 * M_PI);
        r += t;
    }
 
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

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

#define PI 3.14159265358979323

int main(void)
{
  double deg = 30;
  double ang = 90;
  double len = 2;
  double ansx = 0, ansy = 0;
  while (1) {
    scanf("%lf,%lf", &len, &deg);
	if (len == 0 && deg == 0)
		break;
    double rad = ang * PI / 180.0;
    double x = len * cos( rad );
    double y = len * sin( rad );
	ang = ang - deg;
//    printf( "X=%f Y=%f\n", x, y );
	ansx = ansx + x;
	ansy = ansy + y;
  }
  printf( "%.0f\n%.0f\n", floor(ansx), ceil(ansy) );

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
	int h,k;
	double x=0,y=0;int d=0;
	for(;scanf("%d,%d",&h,&k),h;){
		x+=cos(d/180.*M_PI)*h;
		y+=sin(d/180.*M_PI)*h;
		d+=k;
	}
	cout<<(int)y<<endl<<(int)x<<endl;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>


int main()
{
double N,P=0;
double x,y;
double p=0,P1=0;
x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P1);
if((int)N==0&&(int)P1==0)break;

if(0<=(int)P&&(int)P<90){p=P*M_PI/180;x+=N*sin(p);y+=N*cos(p);}
else if(90<=(int)P&&(int)P<=180){p=(180-P)*M_PI/180;x+=N*sin(p);y-=N*cos(p);}
else if(0>(int)P&&(int)P>=-90){p=(-1*P)*M_PI/180;x-=N*sin(p);y+=N*cos(p);}
else if(-90>(int)P&&(int)P>=-180){p=(180+P)*M_PI/180;x-=N*sin(p);y-=N*cos(p);}
P=P1;
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int x, r;
	char split;
	double cx = 0.0;
	double cy = 0.0;
	int cr = 0;
	while (cin >> x >> split >> r) {
		if (x == 0 && r == 0) break;
		cx += x * sin(cr * M_PI / 180.0);
		cy += x * cos(cr * M_PI / 180.0);
		cr += r;
	}
	cout << static_cast<int>(cx) << endl;
	cout << static_cast<int>(cy) << endl;

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>


int main()
{
double N,P;
double x,y;

x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P);
if((int)N==0&&(int)P==0)break;
double p;
if(0<=(int)P&&(int)P<90){p=P*M_PI/180;x+=N*sin(p);y+=N*cos(p);}
else if(90<=(int)P&&(int)P<=180){p=(180-P)*M_PI/180;x+=N*sin(p);y-=N*cos(p);}
else if(0>(int)P&&(int)P>=-90){p=(-1*P)*M_PI/180;x-=N*sin(p);y+=N*cos(p);}
else if(-90>(int)P&&(int)P>=-180){p=(180+P)*M_PI/180;x-=N*sin(p);y-=N*cos(p);}
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

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