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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double x = 0,y = 0,a,b;
  char c;
  int angle = 90;
  while(cin >>a >> c >> b){
    if(a == 0 && b == 0) break;
    x += cos(angle * PI/180) * a;
    y += sin(angle * PI/180) * a;
    angle -= b;
    angle %= 360;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += -(double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

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

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

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

using namespace std;
#define PI 3.1415926535897932

int main(){
	double x=0.0, y=0.0;
	int	dir=90, step, ang;
	char dmy;

	while(1){
	cin >> step >> dmy >> ang;
	if((step==0) && (ang==0)){
		cout<< (int)x << endl << (int)y << endl;
		return 0;
	}
		x+=(cos((long double)dir/180*PI)*step);
		y+=(sin((long double)dir/180*PI)*step);

		dir=(dir-ang)%360;
	}
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define PI 3.141592

int main(){

	int a,b; int c=90; double x=0; double y=0;
	while(true){
	scanf("%d %d",&a,&b);
	if(a==0 && b==0) break;
	x+=a*cos(c*PI/180);
	y+=a*sin(c*PI/180);
	c-=b;

	}

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

	return 0;

    }

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

int main()
{
	int len, angle;
	int sum_ang = 90; // start
	double x = 0.0, y = 0.0;

	// ang(+) -> right 
	while (scanf("%d,%d", &len, &angle), len != 0 && angle != 0){
		x += len * cos(M_PI * sum_ang / 180.0);
		y += len * sin(M_PI * sum_ang / 180.0);

		sum_ang = (sum_ang - angle + 360) % 360;
	}

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

	return (0);
}

C++: #define _USE_MATH_DEFINES
#include <complex>
#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
	double current_angle_in_degree = 0;
	complex<double> current_position = 0;

	int input_distance = 0, input_angle_in_degree = 0;
	while (scanf("%d,%d", &input_distance, &input_angle_in_degree) == 2) {
		if (input_distance == 0 && input_angle_in_degree == 0) {
			break;
		}
		double angle_in_radian = current_angle_in_degree * M_PI / 180.0;
		current_position += static_cast<double>(input_distance)
			* complex<double>(cos(angle_in_radian), sin(angle_in_radian));
		current_angle_in_degree += input_angle_in_degree;
	}

	printf("%d\n%d\n",
		 static_cast<int>(current_position.imag()),
		 static_cast<int>(current_position.real()));

	return 0;
}

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

#define PI 3.14159265

int main(void){
    double x,y,curAn;
    int theta, r;
    
    x = y = 0;
    curAn = 0;
    while (scanf("%d,%d", &r, &theta)){
        if (theta==0 && r==0) break;
        x -= r*cos(curAn);
        y += r*sin(curAn);
        curAn = theta * 2 * PI /360.0;
    }
    printf("%d\n%d\n", (int)x, (int)y);
    return 0;
}

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

int main(){
double x,y,angle,t,r;
x=0;
y=0;
angle=M_PI/2;
while(1){
scanf("%lf,%lf",&r,&t);
if(r==0&&t==0)break;
x+=r*cos(angle);
y+=r*sin(angle);
angle+=t*M_PI/180;
}
printf("%d\n%d\n",(int)-x,(int)y);
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\n%.0f\n",posX,posY);
}

C++: #include <bits/stdc++.h>

using namespace std;

#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679L

int main()
{
	long double x , y;
	char c;
	long double nowX = 0.0L , nowY = 0.L , nowA = 0.L;
	while(cin >> x >> c >> y , x || y)
	{
		nowX += cosl(PI*nowA / 180.L)*x;
		nowY += sinl(PI*nowA / 180.L)*x;
		nowA += y;
		if(nowA > 360.L)
		{
			nowA -= 360.L;
		} else if(nowA < 0.0L)
		{
			nowA += 360.L;
		}
	}
	cout << ( long long int )nowY << endl << ( long long int )nowX << endl;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double x,y,dir=M_PI/2.0;
int a,b;
char c;
int main(){
  x=y=0.0;
  while(cin>>a>>c>>b&&a){
    x-=cos(dir)*(double)a;
    y+=sin(dir)*(double)a;
    dir+=b/180.0*M_PI;
    while(dir>=2.0*M_PI)dir-=2.0*M_PI;
    while(dir<0.0)dir+=2.0*M_PI;
    
  }
  cout<<(int)x<<' '<<(int)y<<endl;
  return 0;
}