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>

static const double M_PI = 6*asin(0.5);

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore(); //read ,
		cin >> deg;

		if(len == 0 && deg == 0) break;

		//proceed
		x += len * cos(direction * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		//turn clockwise
		direction -= deg;

	}

	i_x = x;
	i_y = y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

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

using db = double;
const db pi = 4 * atan(1);

void p(db x) {
	if(x >= 0)
		cout << int(x + 1e-9) << '\n';
	else
		cout << int(x - 1e-9) << '\n';
}

int main() {
	cout << fixed << setprecision(0);
	ios :: sync_with_stdio(false);
	db d, t; char c;
	db x = 0, y = 0, a = 90;
	while(cin >> d >> c >> t) {
		x += d * cos(a / 180 * pi);
		y += d * sin(a / 180 * pi);
		a -= t;
	}
	p(x); p(y);
	return 0;
}

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

int main(void){
	int deg=0;
	int a,b;
	double x,y;

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

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

using namespace std;

#define PI 4 * atan(1.0)

int main(void){
	int w, r, d = 0;
	double x = 0, y = 0;
	while(1){
		scanf("%d%*c%d%*c",&w,&r);
		if(w == 0 && r == 0){
			break;
		}
		x += w * cos(d * PI / 180);
		y += w * sin(d * PI / 180);
		d += r;
	}
	printf("%d\n%d\n",(int)y,(int)x);
	return 0;
}

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

using namespace std;

int main(){
	double sumX = 0;
	double sumY = 0;
	double d,rad = 3.1415/2;
	double theta;
	while(1){

		cin >> d ;
		getchar();
		cin >> theta;
		if(d == 0 and theta == 0) break;
		sumX += d * cos(rad);
		sumY += d * sin(rad);
		rad -= (3.1415*theta)/180.0;
	}

	cout << (int)sumX << " " << (int)sumY << endl;
	return 0;
}

C++: #include <cmath>
#include <cstdio>
double x, y, a; int s, t;
int main() {
	while(~scanf("%d,%d", &s, &t)) {
		x += s * cos(a);
		y += s * sin(a);
		a += t / 180.0 * 3.14159265358979;
	}
	printf("%d\n%d\n", (int)y, (int)x);
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
  int w,a,ang=90;
  double x=0,y=0,r;
  while(1){
    scanf("%d,%d",&w,&a);
    if(w==0 && a==0)break;
    r=(double)ang/180.0*M_PI;
    x+=cos(r)*w;
    y+=sin(r)*w;
    ang-=a;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

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

#define pi 2*acos(0.0)

int main()
{
    float a , b , u=0 , x=0 , y=0 ;
    char ch ;
    while(scanf("%f%c%f",&a,&ch,&b)!=EOF)
    {
        if(a==0 && b==0) break ;
        x+=a*sin(u*pi/180.0) ;
        y+=a*cos(u*pi/180.0) ;
        u+=b ;
    }
    x=(int)x ; y=(int)y ;
    printf("%.0lf\n%.0lf\n",x,y) ;
    return 0 ;
}

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

#define PI 3.1415927

int main(){
	
	double n , angle , red = 90 ;
	double x=0 , y=0 ;
	
	while(1){
		scanf("%lf,%lf",&n ,&angle ) ;
		if( n==0 && angle==0 ) break ;
		
		x += n*cos(PI/180 * red) ;
		y += n*sin(PI/180 * red) ;
		
		red -= angle ;
	}
	
	int ans_x = x ;
	int ans_y = y ;
	
	printf("%d\n%d\n",ans_x ,ans_y) ;
	
return 0 ;
}

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

const double PI = acos(-1);

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*PI/180.0), y += w * sin(cAng*PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define PI 3.141592

int d, t;
double x, y, deg;

int main() {
	x = 0;
	y = 0;
	deg = 90;

	scanf("%d,%d", &d, &t);
	while (!(d == 0 && t == 0)) {
		x += d * sin((double)deg / 180 * PI);
		y += d * cos((double)deg / 180 * PI);
		deg -= t;
		scanf("%d,%d", &d, &t);
	}
	cout << (int)y << endl;
	cout << (int)x << endl;

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

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

void walk(double current_point[2], int r, int sum_theta) {
	double pi = 3.14159265358979; 
	double rad = ((double)sum_theta / 180) * pi;
	current_point[0] += r * sin(rad);
	current_point[1] += r * cos(rad);
}

int main() {
	int r;
	int theta;
	int sum_theta = 0;
	double current_point[2] = {0, 0};

	do {
		scanf("%d,%d", &r, &theta);

		walk(current_point, r, sum_theta);
		sum_theta += theta;
	} while(r || theta);

	printf("%.0lf\n", current_point[0]);
	printf("%.0lf\n", current_point[1]);

	return 0;
}

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

using namespace std;

#define PI 3.141592654

struct point{
	double x;
	double y;
};

struct input{
	double length;
	double theta;
};

double get_radian( double theta_deg );
ostream& operator << ( ostream& s , point& p );

int main(void)
{
	input data;
	point goal = { 0.0 , 0.0 };
	double theta = 90;

	while(1)
	{
		scanf("%lf , %lf" , &data.length , &data.theta );
		if( data.length == 0 && data.theta == 0 ) break;

		goal.x += data.length * cos( get_radian(theta) );
		goal.y += data.length * sin( get_radian(theta) );

		theta -= data.theta;
	}
	cout << goal;
}

double get_radian( double theta_deg )
{
	return theta_deg*PI/180;
}

ostream& operator << ( ostream& s , point& p )
{
	return s << int(p.x) << endl << int(p.y) << endl;
}

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

const double pi = acos(-1);

int main() {
  int len, ang;
  double ax = 0, ay = 0;
  double vis = 90;

  while(scanf("%d,%d", &len, &ang)) {
    if(len+ang == 0) break;

    ax += len * cos(pi*vis/180);
    ay += len * sin(pi*vis/180);
    vis -= ang; 
  }

  cout << (int)ax << endl;
  cout << (int)ay << endl;
}