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<stdio.h>
using namespace std;
int main() {
	double sum,x,y,b,c;
	int a, d;
	a = 0;
	x = 0;
	y = 0;
	sum = 0;
	while (scanf_s("%d,%d",&d,&a)) {
		if (a == 0 && d == 0) break;
		b = (double)a;
		c = (double)d;
		x += c*cos(sum*3.1416/180);
		y += c*sin(sum*3.1416/180);
		sum += b;
	}
	cout << (int)y << " " << (int)x << endl;
	return 0;
}

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

using namespace std;

const double PI = 3.14159;

int main()
{
	double x=0.0, y=0.0;
	int deg = 0;
	int d, t;
	char dummy;
	
	while (true) {
		cin >> d >> dummy >> t;
		if (d==0 && t==0) break;
		
		x += static_cast<double>(d) * sin(static_cast<double>(deg)*PI/180);
		y += static_cast<double>(d) * cos(static_cast<double>(deg)*PI/180);
		deg += t;
	}
	
	cout << static_cast<int>(x) << endl << static_cast<int>(y) << endl;
	
	return 0;
}

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

int main(){
  int d, a = 90, a2; 
  double x,y;
  char c;
  while(cin >> d >> c >> a2){
    if(d == 0 && a == 0) break;
    double rad = a * (PI / 180);
    x += d * cos(rad);
    y += d * sin(rad);
    a += a2;
    }
  }
  cout << (int)x << "\n" << (int)y << endl;
}

C++: #include<iostream>
#include<cmath>
float a,b,x,y,p=6*asin(0.5),d=90;int main(){for(;(std::cin>>a).ignore()>>b,a||b;){x+=a*cos(d*p/180.f);y+=a*sin(d*p/180.f);d-=b;}printf("%d\n%d\n",int(x),int(y));}

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

int main(){
	double teku[10000]={0.0},sita=0.0,set_sita[10000]={0.0},x=0.0,y=0.0;
	int i=0,j=0;
	
	while(scanf("%lf,%lf",&teku[i],&set_sita[i])!=EOF){
		if(teku[i]==0 && set_sita[i]==0)break;
		
		set_sita[i]=set_sita[i]/180 * pi;			
		
		for(j=0;j<teku[i];j++){
			x+=cos(sita);
			y+=sin(sita);
		}
		sita+=set_sita[i];
		i++;
	}
		printf("%.0f\n%.0f\n",x,y);
	return 0;
}

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

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

	int l, a;

	while(scanf_s("%d,%d",l,a) != -1){
		x += l * cos(a * PI / 180);
		y += l * sin(a * PI / 180);
	}

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

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define Pi 3.14159265358979323846 
signed main(void){
	double x,y,a=0,b=0,f=Pi/2;
	char c;
	while(cin>>x>>c>>y){
		if(x==0&&y==0)
			break;
		a+=x*cos(f);
		b+=x*sin(f);
		f-=Pi*((double)y/180.0);
	}
	cout<<(int)a<<endl
		<<(int)b<<endl;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#define PI 3.141592
using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	double x = 0, y = 0;
	double dist, ang = 0, d;

	while(scanf("%lf,%lf", &dist, &d)) {
		if(!dist && !d) break;
		x += sin(ang * M_PI / 180) * dist;
		y += cos(ang * M_PI / 180) * dist;
		ang += d;
	}

	cout << (int)x << endl << (int)y << endl;
	return 0;
}

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

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*M_PI/180);
		h+=x*cos(r*M_PI/180);
		r-=y;

		if(r>270)
		{
			r-=360;
		}
		else if(r<-270)
		{
			r+=360;
		}
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

#define PI 3.1415926535897932386

int main()
{
	int x, r;
	double X = 0, Y = 0, rad = 90;

	while(1){
		//üÍ
		cin>>x;
		cin>>r;

		//0¾Á½çIíé
		if(x == 0 && r == 0){
			break;
		}

		X += x * cos(rad * PI/180);
		Y += x * sin(rad * PI/180);

		rad -= r;
	}
	
	X = (int)X;
	Y = (int)Y;

	cout<<X<<endl<<Y;

	cin.sync();
	cin.get();
}

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

int main(){

  int r, deg, theta;
  double x, y, rad;

  x = 0.0;
  y = 0.0;
  theta = 0;
  rad = M_PI / 180;
  do{
    scanf("%d, %d", &r, &deg);
    if(r == 0 && deg == 0) break;
  	x += r * cos(theta * rad);
  	y += r * sin(theta * rad);
    theta = theta + deg;
  }while(1);

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

  return 0;
}

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

struct TCoordinate
{
	double X;
	double Y;
};

struct TPolarCoordinate
{
	int Distance;
	int Degree;
};

TCoordinate Move(TPolarCoordinate PolarCoordinate, TCoordinate CurrentCoordinate)
{
	CurrentCoordinate.Y += PolarCoordinate.Distance * cos(PolarCoordinate.Degree * M_PI / 180);
	CurrentCoordinate.X += PolarCoordinate.Distance * sin(PolarCoordinate.Degree * M_PI / 180);
	return CurrentCoordinate;
}

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

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define PI 3.141592
using namespace std;

int main(void){

    double x=0,y=0;
    int a,b;
    int q=90;
    char z;
    for(;;){
    scanf("%d%c%d",&a,&z,&b);
        if(a==0&&b==0)break;
        y += a*sin(((double)q/180)*3.141592);
        x += a*cos(((double)q/180)*3.141592);
        q -= b;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    return 0;
}

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

#define PI 3.14

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*PI/180);
		h+=x*cos(r*PI/180);
		r-=y;

		if(r>270)
		{
			r-=360;
		}
		else if(r<-270)
		{
			r+=360;
		}
	}
	printf("%.0f\n%.0f\n",h,k);
}