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 <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

struct THuman
{
	double X;
	double Y;
	int Degree;
};

THuman Move(int Distance, THuman Human)
{
	Human.Y += Distance * cos(Human.Degree * M_PI / 180);
	Human.X += Distance * sin(Human.Degree * M_PI / 180);
	return Human;
}

int main()
{
	THuman Human = {0, 0, 0};
	while(true){
		int Distance;
		int Degree;
		char Dummy;
		cin >> Distance >> Dummy >> Degree;
		if(Distance == 0 && Degree == 0) break;
		Human = Move(Distance, Human);
		Human.Degree += Degree;
	}
	double GaussX, FractionalX, GaussY, FractionalY;
	FractionalX = modf(Human.X, &GaussX);
	FractionalY = modf(Human.Y, &GaussY);
	cout << fixed << setprecision(0) << GaussX << endl << GaussY << endl;
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main()
{
	int k,h;
	double p,tt,yk,x=0,y=0,r,mk=0;
	p=atan(1.0) * 4.0;
	while(1){
		scanf("%d,%d",&h,&k);
		if(h==0&&k==0){
			break;
		}
		mk+=k;
		if(mk>=360){
			mk-=360;
		}
		if(mk<=360){
			mk+=360;
		}

		r=((90-mk)*p)/180;
		yk=cos(r)*h;
		tt=sin(r)*h;
		x+=yk;
		y+=tt;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

const double PI = 4 * atan(1);
int naturalPart(const double r){
    if(r>0) return floor(r);
    else    return ceil(r);
}

int main(){
    double x = 0, y = 0;
    int stride, dir = 90, rot;
    while(1){
        std::cin >> stride;
        x += stride * cos(dir * PI / 180);
        y += stride * sin(dir * PI / 180);
        std::cin.ignore() >> rot;
        if(!stride && !rot)
            break;
        dir -= rot;
    }
    
    std::cout << naturalPart(x) << '\n' << naturalPart(y) << std::endl;
    return 0;
}

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

#define PI (3.141592)

int main()
{
	int hosu, angle,angleplus;
	angle = 0;
	double x = 0,y=0;
	char c;
	while( cin >> hosu >> c >> angleplus ) {
		if( hosu == 0 && angleplus == 0 )
			break;
		x += hosu * sin(angle * PI / 180 );
		y += hosu * cos(angle * PI / 180 );
		angle += angleplus;
		
	}
	printf("%.0f\n%.0f",x-0.5,y-0.5);

	return 0;
}

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

int main() {
	double x=0, y=0, a, b, now = 90;
	char c;
	while (cin >> a >> c >> b, a || b) {
		x += a * cos(M_PI * now / 180);
		y += a * sin(M_PI * now / 180);
		now = now - b;
	}
	if (x >= 0) x = floor(x);
	else if (x < 0) x = ceil(x);
	if (y >= 0) y = floor(y);
	else if (y < 0) y = ceil(y);
		cout << x << " " << y << endl;
}

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

const double rad = (3.14159265 / 180);

int main(){

	int m, angle, sumangle = 0;
	double x = 0, y = 0;

	char c;

	while (std::cin >> m >> c >> angle, m || angle){

		x += (std::cos((90 - sumangle)*rad)*m);
		y += (std::sin((90 - sumangle)*rad)*m);
		sumangle += angle;
	}

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

	return 0;
}

C++: #include <cmath>
#include <stdio.h>

const double PI = 3.141592653589;

int main()
{
	int len,deg;
	double x,y,deg_sum;
	x = 0;
	y = 0;
	deg_sum = 0;
	scanf("%d,%d",&len, &deg);
	while(len != 0 || deg != 0){
		x += sin(deg_sum * PI / 180) * (double)len;
		y += cos(deg_sum * PI / 180) * (double)len;
		deg_sum += (double)deg;
		scanf("%d,%d",&len, &deg);
	}
	if(x > -0.5 && x < 0.5){
		x = 0;
	}
	if(y > -0.5 && y < 0.5){
		y = 0;
	}
	printf("%.0f\n%.0f\n",x,y);
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90;
	char c;
	cin >> d >> c >> a;

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca -= a;
		cin >> d >> c >> a;

	} while (d != 0 || a != 0);
	//cout << fixed << setprecision(0) << x << endl << y << endl;
	cout << int(x) << endl << int(y) << endl;
}

C++: #include <stdio.h>
#include <math.h>
int main()
{
    double d,a,s,x,y;
    x = 0.0;
    y = 0.0;
    s = M_PI/2;
    while(scanf("%lf,%lf",&d,&a) != EOF){
        x -= d*cos(s);
        y += d*sin(s);
        s += a/180*M_PI;
    }
    int ax = x;
    int ay = y;
    printf("%d\n%d\n",ax,ay);
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int a,b;
    char c;
    double pi=acos(-1.0);
    double x=0,y=0,angle=90;
    for(;;){
       cin>>a>>c>>b;
       if(a==0 && b==0) break;
       x+=a*cos(angle*pi/180);
       y+=a*sin(angle*pi/180);
       angle-=b;      
   }
   cout<<(int)x<<"\n"<<(int)y<<endl;
   return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<cstdio>
#include<string.h>
using namespace std;

int main()
{
	double hosu, kaku, x=0, y=0, now=0;

	while (1)
	{
		scanf("%lf,%lf", &hosu, &kaku);
		if (hosu == kaku&&hosu==0)break;
		x += sin(now)*hosu;
		y += cos(now)*hosu;
		now += kaku / 180 * 3.1415;

	}
	int A = x;
	int B = y;
	cout << A<< endl << B << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#define P 3.14159265358979
using namespace std;

double Y(int z){
	if(z<180)return sin(P/180*z);
	return -sin(P/180*(360-z));
}
double X(int z){
	if(z<180)return cos(P/180*z);
	return cos(P/180*(360-z));
}
int main(){
	double x=0,y=0;
	int z=90,a,b;char u;
	while(cin>>a>>u>>b&&a+b){
		y+=a*Y(z),x+=a*X(z);
		z-=b;z%=360;if(z<0)z+=360;
	}
	int xx=x,yy=y;
	cout<<xx<<" "<<yy<<endl;
	return 0;
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
double degToRad(int deg) {
  return deg * M_PI / 180;
}
 
int main(void) {
  double x = 0.0, y = 0.0;
  int deg = 90;
 
  while(1) {
    int l, d;
    scanf("%d,%d", &l, &d);
    if(l == 0 && d == 0) break;
 
    x += l*cos(degToRad(deg));
    y += l*sin(degToRad(deg));
 
    deg -= d;
  }
 
  cout << (int)x << endl;
  cout << (int)y << endl;
 
  return 0;
}

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

using namespace std;

void solve()
{
	int d, t;
	double x = 0, y = 0;
	double angle = 90;
	while(true)
	{
		scanf("%d,%d", &d, &t);
		if(d == 0 && t == 0)
		{
			break;
		}
		x += d * cos(angle / 180 * M_PI);
		y += d * sin(angle / 180 * M_PI);
		angle -= t;
	}
	cout << (int)x << endl;	
	cout << (int)y << endl;
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <string>
#include <cmath>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

double totheta(int k){
	double ret = k * M_PI / 180.0;
	return ret;
}

int main(){
	string input;
	int meter = 0, theta = 0;
	float x=0, y=0, c=0;
	while (true)
	{
		scanf("%d,%d", &meter, &theta);
		if (meter == 0 && theta == 0) { break; }
		x += meter * sin(c);
		y += meter * cos(c);
		c += totheta(theta);
	}
	int ansx, ansy;
	ansx = x;
	ansy = y;
	cout << ansx << endl << ansy << endl;
	return 0;
}