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 <stdio.h>
#include <math.h>


int main(){
	double x = 0,y = 0;
	int tmp_x,tmp_y,degree=90;

	while(true){
		scanf("%d,%d",&tmp_x,&tmp_y);
		if(tmp_x == 0 && tmp_y == 0)break;
		x += tmp_x*cos(degree*M_PI/180);
		y += tmp_x*sin(degree*M_PI/180);
		degree -= tmp_y;
	}

	printf("%d\n",(int)x);
	printf("%d\n",(int)y);

    return 0;
}

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

int main() {
  
  double x=0,y=0,radian;
  int toward,deg1,deg2;
  char ch;
  
  cin >> toward >> ch >> deg1;
  y += toward;
  
  while(1){
      cin >> toward >> ch >> deg2;
      if (toward==0&&deg2==0)break;
      
      radian = acos(-1) /180  * deg1;
      x += sin(radian)*toward;
      y += cos(radian)*toward;
      deg1 += deg2;
  }
  
  cout << (int)x << endl << (int)y << endl;
  return 0;
  
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


constexpr long double pi = acos(-1L);

V<string> split(const string& s, char c) {
  V<string> res;
  stringstream ss(s);
  string t;
  while (getline(ss, t, c)) res.push_back(t);
  return res;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  long double x = 0, y = 0;
  int th = 90;
  string s;
  while (getline(cin, s)) {
    auto ss = split(s, ',');
    int d = stoi(ss[0]), a = stoi(ss[1]);
    if (d == 0) break;
    x += d * cos(th * pi / 180);
    y += d * sin(th * pi / 180);
    th -= a;
  }
  cout << static_cast<int>(x) << '\n';
  cout << static_cast<int>(y) << '\n';
}

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

double PI = 3.141592;

int main(void) {

    double x = 0;
    double y = 0;
    double r = 0;
    double a = 90;
    double d = 0;
    while(true){

        scanf("%lf,%lf", &r, &d);
        if( r == 0 && d == 0 ) break;

        x += r * cos( a * PI / 180 );
        y += r * sin( a * PI / 180 );
        cerr << x << " " << y << endl;
        a -= d;
    }
    cout << (int)x << " " << (int)y << endl;


    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a,b,x = 0,y = 0,angle = 90;
  while(scanf("%lf,%lf",&a,&b),a||b){
    x+=a*cos(angle*2*M_PI/360);
    y+=a*sin(angle*2*M_PI/360);
    angle-=b;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}

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;

	double aaa = sin(90);
	aaa = sin(90*M_PI / 180);

	while (scanf("%d,%d", &a, &b), a&&b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius += b;
	}
	cout << (int)y << endl << (int)x << endl;                                                        
	return 0;
}

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

int main() {
  int w;
  int cAng = 90, ang;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>ang && w != 0 && ang != 0) {
    x += w * cos(cAng*M_PI/180.0), y += w * sin(cAng*M_PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

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

int main(){
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(cin >>x>> c >> y){
		if(x==0&&y==0) break;
		sum_y += x*cos(theta*M_PI/180);
		sum_x += x*sin(theta*M_PI/180);
		theta += y;
	}
	cout << (int)sum_x<<endl;
	cout <<(int)sum_y<<endl;

}

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

#define M_PI 3.14159265358979

int main(void)
{
    int step, dig;
    double x, y, angle;

    x = 0;
    y = 0;
    angle = 0;

    while (1){
        scanf("%d,%d", &step, &dig);

        if (step == 0 && dig == 0){
            break;
        }

        x += (double)step * sin(angle * (M_PI / 180));
        y += (double)step * cos(angle * (M_PI / 180));
        angle += (double)dig;
    }

    printf("%d\n%d\n", (int)x, (int)y);

    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <numeric>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	double l, a, b, x = 0, y = 0, c = 0;
	while (scanf("%lf,%lf", &l, &a)){
		if (l == 0 && a == 0)break;
		if (c == 0){
			y += l;
		}
		else{
			x += l*sin(b / 180.0*PI);
			y += l*cos(b / 180.0*PI);
		}
		b += a;
		c++;
	}
	cout << (int)x << "\n" << (int)y << "\n";
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x = 0, y = 0, r = M_PI/2.0;
    int a, b;
    char delim;
    while (cin >> a >> delim >> b, a||b) {
        x += a * cos(r);
        y += a * sin(r);
        r -= b * M_PI / 180.0;
    }
    cout << (int)x << "\n";
    cout << (int)y << "\n";

    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;

int main()
{	
	double posX=0;
	double posY=0;
	double angle=90;
	string str;
	while(getline(cin,str,',')){
		string str2;
		getline(cin,str2);

		int a,b;
		sscanf(str.c_str(),"%d",&a);
		sscanf(str2.c_str(),"%d",&b);

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

		posX -= a * sin(M_PI/2.0 -angle/180.0*M_PI);
		posY += a * cos(M_PI/2.0 -angle/180.0*M_PI);

		angle += b;	
		cout << posX << ":" << posY << endl;
	}
	printf("%.0f %.0f\n",posX,posY);
}

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

int main(void)
{
	float len;
	float ang, angin;
	float x, y;
	
	x = 0;
	y = 0;
	ang = 90;
	while (1){
		scanf("%f,%f", &len, &angin);
		
		if (len == 0 && angin == 0){
			break;
		}
		
		y += (sin(ang / 180 * M_PI) * len);
		x += (cos(ang / 180 * M_PI) * len);
		
		ang -= angin;
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return (0);
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  double 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;
  }
  cout << (int)x << endl << (int)y << endl;

}