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>
int main(){
	int a,b,r=0;double x=0,y=0;
	while(scanf("%d,%d",&a,&b),a||b){
		x+=a*cos(r*M_PI/180.0);
		y+=a*sin(r*M_PI/180.0);
		r+=b;
	}
	printf("%d\n%d\n",(int)y,(int)x);
}

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

#define calc(x) (x*M_PI/180.0)

using namespace std;

int main()
{
  string str;
  int a, b;
  double x=0, y=0, r=0;

  while(scanf("%d,%d",&a,&b) != EOF && !(a == 0 && b == 0)){
    x += (double)a*sin(calc(r));
    y += (double)a*cos(calc(r));
    r += (double)b;
  }
  printf("%d\n%d\n", (int)x, (int)y);

  return 0;
}

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

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

	while ( scanf( "%lf,%lf", &dis, &deg ), dis + deg ){
		x -= dis * sin( sdeg );
		y += dis * cos( sdeg );
		
		deg = deg * PI / 180.0;
		sdeg -= deg;
	}
	cout << (int)x << endl << (int)y << endl;
	
	return 0;
}

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

static double PI = 3.14159265;

using namespace std;

double dtor(double);

int main() {
    int d, a;
    double f = 90.0, x = 0.0, y = 0.0;

    while(true) {
        scanf("%d,%d", &d, &a);
        if(d == 0 && a == 0) { break; }

        x += d * cos(dtor(f));
        y += d * sin(dtor(f));

        f -= a;
    }
    printf("%d\n%d\n", (int)x, (int)y);
}

double dtor(double deg) {
    return (deg * PI) / 180;
}

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 << (int)y << endl;
    return 0;
}

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

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

const double EPS = 0.1;

int main(){
	
	int a,b;
	double angle = M_PI/2;
	P pos = P(0,0);
	
	while(scanf("%d,%d",&a,&b)){
		if(a==0 && b==0)break;
		pos += P(cos(angle),sin(angle))*(double)a;
		angle -= b/180.0*M_PI;
	}
	
	printf("%d\n%d\n",(int)pos.X,(int)pos.Y);
}

C++: #include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
#define  PI 3.141592
int main(void){
    long double x=0.0, y=0.0;
    int distance, angle, angle_total=0;
    char commma;
    
   
    while(1){
        cin >> distance>> commma >> angle;
        if(angle == 0 && distance == 0) break;
        x += distance * cos((90-angle_total)*PI/180);
        y += distance * sin((90-angle_total)*PI/180);
        angle_total += angle;
        


    }
    int int_x = x;
    int int_y = y;
    cout <<  int_x << endl << int_y << endl;
    return 0;
}

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

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 90;
	while(scanf("%lf,%lf",&hosu,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		printf("%lf\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos -= kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

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

	int l, a;

	while(scanf("%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 <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle=0;
while(1){
scanf("%d,%d",&step,&turn);
if(!step&&!turn)break;
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define _USE_MATH_DEFFINES
#include <cmath>
using namespace std;
typedef complex<double> P;

double convert(double angle) {
    return((M_PI * (angle / 180.0)));
}

P now(0, 0);
double angle = 0;

int main(void) {
    int fd, spin;
    
    while(scanf("%d,%d", &fd, &spin), fd + spin != 0) {
        double nextx = now.real() + fd * sin(convert(angle)),
        nexty = now.imag() + fd * cos(convert(angle));
        now = P(nextx, nexty);
        angle += spin;
    }
    cout << (int)now.imag() << endl << (int)now.real() << endl;
    return(0);
}

C++: #include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#define _USE_MATH_DEFINES

using namespace std;
int main(){
  int l,a;
  string sl,sa;
  double x,y,aa;
  x=y=aa=0;
  while(true){
  getline(cin,sl,',');
  getline(cin,sa,'\n');
  l = atoi(sl.c_str());
  a = atoi(sa.c_str());
  if (!l&&!a)break;
  x += sin(aa*(2*M_PI)/360)*l;
  y += cos(aa*(2*M_PI)/360)*l;
  aa += a;
  }
  cout << (int)x << endl << (int)y << endl;
}

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


int main(){
  int n;
  int a,b;
  char c;

  double x=0.0, y=0.0;
  int angle=90;

  // cout << M_PI << endl;
  
  while(cin >> a >> c >> b){
    // cout << "---" << endl;
    // cout << a << endl;
    // cout << b << endl;
    if(a==0 && b==0){
      break;
    }
    x += a*cos(angle*M_PI/180.0);
    y += a*sin(angle*M_PI/180.0);
    angle -= b;
    
    if(angle <= -180){
      angle += 360;
    }
    if(angle >= 180){
      angle -= 360;
    }
  }

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

C++: #include <iostream>
#include <cmath>
#define PI acos(-1)
 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=PI/2.0;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr);
                y+=l*sin(nr);
                nr-=r*PI/180.0;
        }
        cout << (int)x <<endl<< (int)y <<  endl;
return 0;
}