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 <cmath>
#include <cstdio>

#define PI 3.141592653589793
#define RAD(d) (d * PI / 180)

using namespace std;

class People{
private:
	int angle;
	double x, y;

public:
	People(){
		angle = 90;
		x = y = 0;
	}
	void move(int distance, int relativeAngle){
		x += distance * cos(RAD(angle));
		y += distance * sin(RAD(angle));
		angle -= relativeAngle;
	}
	double getX(){ return x; }
	double getY(){ return y; } 
};

int main(){
	People me;
	for(int distance, relativeAngle; ~scanf("%d,%d", &distance, &relativeAngle), distance;)
		me.move(distance, relativeAngle);
	cout << (int)me.getX() << endl << (int)me.getY() << endl;

	return 0;
}

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

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

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

int main(){
	
	double x=0,y=0;
	double a,b,t=90;
	char cn;
	while(cin>>a>>cn>>b){
	if(a!=b!=0){
		double s=t*M_PI/180;
		x+=a*cos(s);
		y+=a*sin(s);
		t=t-b;
		
	}
	else
		break;
	}
	printf("%d\n%d\n",(int)x,(int)y);
		
	
}

C++: #include<cstdio>
#include<cmath>
#define PI 3.14159265358979
double rad(double a){
  return a*PI/180.0;
}

int main(){
  int a,b;
  int th=0;
  double x = 0, y = 0;
  while(scanf("%d,%d",&a,&b)){
    if(a==0&&b==0)break;
    x+=a*sin(rad(th));
    y+=a*cos(rad(th));
    th+=b;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

#define PI 3.1415926535898
#define ANGLE (PI/180.0)
int main(){
	int step,dir;
	double x=0.0, y=0.0, angle=0.0;
	
	while(1){
		scanf("%d,%d", &step, &dir);
		if(step==0 && dir==0) break;
		x += (double)(step) * sin( angle*ANGLE );
		y += (double)(step) * cos( angle*ANGLE );
		angle += (double)dir;
	}
	printf("%d\n%d\n", (int)x, (int)y);
}

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

using namespace std;

int steps[999999] = {0};
int degree[999999] = {0};

double toRadian(int d) {
    const double ONE_RAD = 180.0d / M_PI;
    return ((double) d) / ONE_RAD;
}

int main() {
    double x = 0.0d;
    double y = 0.0d;
    double rot = M_PI / 2.0d;
    int counts = 0;
    while (true) {
        scanf("%d,%d", &steps[counts], &degree[counts]);
        if ((steps[counts] == 0) && (degree[counts] == 0)) {
            break;
        }

        counts++;
    }

    for (int i = 0; i < counts; ++i) {
        double tempX = 0.0d;
        double tempY = 0.0d;
        tempX = (double) steps[i] * cos(rot);
        tempY = (double) steps[i] * sin(rot);
        double rad = toRadian(degree[i]);
        rot -=  rad;

        x += tempX;
        y += tempY;
    }

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

    return 0;
}

C++: /*AOJ 0016*/
 
#include<iostream>
#include<math.h>
 
#define M_PI 3.14159265
 
using namespace std;
 
double changeDegToRad(double deg){
 
    return deg*M_PI/180.0;
 
}
 
int main(){
 
    double x = 0,y = 0;
    double deg = 0,walk = 0;
    double rad = M_PI/2.0;
    while(1){
        scanf("%lf,%lf",&walk,&deg);
 
 
        if(deg==0&&walk==0){
            break;
        }
 
        x += walk * cos(rad);
        y += walk * sin(rad);
 
        rad -= changeDegToRad(deg);
 
    }
 
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    return 0;
}

C++: #include <iostream>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
	double x=0,y=0,c=0;
	int a,b;
	while(scanf("%d,%d",&a,&b) != EOF){
		if(a==0 && b==0) break;
		x += (double)a*(double)sin(c*6.0*asin(0.5)/180.0);
		y += (double)a*(double)cos(c*6.0*asin(0.5)/180.0);
		c += (double)b;
		if(c>(double)180){
			c -= (double)360;
		}
		if(c<(double)-180){
			c += (double)360;
		}
	}
	cout<<(int)x<<endl<<(int)y<<endl;
	return 0;
}

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.14159265

vector<int>d;
vector<int>e;
vector<double>u;
vector<double>v;

int main(){

	int a,b;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	d.push_back(a); e.push_back(b);
	}

   int n=d.size();

	int c=90;
    for(int i=0;i<n;i++){
	u.push_back(d[i]*cos(c*PI/180));
	v.push_back(d[i]*sin(c*PI/180));
	c+=-e[i];
    }

	double x=0; double y=0;
	for(int i=0;i<n;i++){
	x+=u[i];
	y+=v[i];
	}

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

	return 0;
    }

C++: #include<iostream>
#include<math.h>
#include<cstdio>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		scanf_s("%d,%d", &len, &deg);
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180.0 * M_PI);
		y += len*sin(deg_now / 180.0 * M_PI);
		deg_now += deg;
	}

	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 angle = 90;

	int l, a;

	while(scanf("%d,%d",&l,&a) + 1){
		if(l == 0 && a == 0)break;

		x += l * cos(angle * PI / 180);
		y += l * sin(angle * PI / 180);

		angle += a;
	}

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

	return 0;
}

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;

int main(){

	double a; double b; double c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

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

	return 0;

    }

C++: #include <iostream>
#include <cmath>
#include <cstdio>
const double PI = 3.141592;
using namespace std;
int main (int argc, char *argv[]) {
	double x = 0.0, y = 0.0;
	int size, t_deg;
	double deg = 90.0;
	while (true) {
		scanf("%d,%d",&size,&t_deg);
		//cout << x << " " << y << endl;
		x += -cos(deg * PI / 180.0) * size;
		y += sin(deg * PI / 180.0) * size;
		if (size == 0 && t_deg == 0) break;
		deg += t_deg;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    double x=0,y=0;
    int now_t=0,p,t;
    
    while(1){
        scanf(" %d,%d",&p,&t);
        
        if(p==0 && t==0) break;
        
        y+=cos(now_t/180.0*PI)*p;
        x+=sin(now_t/180.0*PI)*p;
        
        now_t+=t;
    }
    
    printf("%d\n%d\n",(int)x,(int)y);
    
    return 0;
}