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<cstdio>
#include<cmath>
using namespace std;
int main(void){
  int l,r,r2=90;
  double x=0,y=0;
  double pi=3.141592653589793;
  for(;;){
    scanf("%d,%d",&l,&r);
    if(!l && !r) break;
    x+=l*cos(r2*pi/180);
    y+=l*sin(r2*pi/180);
    r2-=r;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

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;


	while (scanf_s("%d,%d", &a, &b), a&&b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius += b;
	}
	y *= 10;
	y %= 10;
	y /= 10;

	x *= 10;
	x %= 10;
	x /= 10;

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

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

using namespace std;

int main(){
	double	x = 0,
		y = 0;
	int	deg = 0;
	int	p, q;
	while(scanf("%d,%d", &p, &q) && p && q){
		x += p * sin(deg * M_PI / 180);
		y += p * cos(deg * M_PI / 180);	
		deg += q;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include<iostream>
#include<cmath>
#define PI 3.141592653589793
using namespace std;
int main(){
	char z;
	int a;
	double b;
	int i,j,k;
	double x=0,y=0;
	double d=0;
	while(cin>>a>>z>>b){
		if(a==0)break;
		x+=(double)a*cos(d/180.0*PI);
		y+=(double)a*sin(d/180.0*PI);
		d+=b;
	}
	cout<<(int)y<<endl;
	cout<<(int)x<<endl;
	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;	
	}
	printf("%.0f\n%.0f\n",floor(posX),ceil(posY));
}

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

#define PI 3.14159265358979323846
using namespace std;

int length, angle, currentAngle;
double px, py;
 
void walk(){
    double dx = length * cos(currentAngle * PI / 180.0);
    double dy = length * sin(currentAngle * PI / 180.0);
    currentAngle -= angle;
    px += dx;
    py += dy;
}

main(){
    px = 0;
    py = 0;
    currentAngle = 90;
    while(1){
	scanf("%d,%d", &length, &angle);
	if ( length == 0 && angle == 0 ) break;
	walk();
    }
    int x = (int)px;
    int y = (int)py;
    printf("%d\n", x);
    printf("%d\n", y);
}

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

int main(){
	int r, d, sd=90;
	double x=0.0, y=0.0;
	while( scanf("%d,%d",&r,&d)==2 && !(r==0 && d==0) ){
		x += r * cos(sd*3.141592/180.0);
		y += r * sin(sd*3.141592/180.0);
		sd -= d;
		if( sd>180 )			sd -= 360;
		else if( sd<-180 )	sd += 360;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

#define PI 3.1415926535

int main() {
	int dir=90, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&adv!=0.0&&rad!=0.0) {
		x += cos(dir*PI/180)*adv;
		y += sin(dir*PI/180)*adv;
		dir -= rad;
		if (dir < 0) dir += 360;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

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

int main(){
  const double PI=3.14159265358979;
  double inr=0,ind=0;
  double x=0,y=0;
  int degree=90;
  while(scanf("%lf,%lf",&inr,&ind) , inr||ind){
    y+=inr*sin(PI/180*degree);
    x+=inr*cos(PI/180*degree);
    degree-=ind;
  }
  x=(int)x;
  y=(int)y;
  cout<<x<<endl<<y<<endl;
  return 0;
}

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

int main(){
	double x = 0.0;
	double y = 0.0;
	double r = M_PI*0.5;
	while(1){
		int a,b;
		char com;
		cin >> a >> com >> b;
		if(a==0 && b==0) break;
		x += double(a)*cos(r);
		y += double(a)*sin(r);
		r -= M_PI*b/180.0;
	}
	int c = int(x);
	int d = int(y);
	cout << c << endl;
	cout << d << endl;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	P p;
	double c_r = 90;
	double x,r; char c;
	while(cin>>x>>c>>r,(x||r)){
		P add = P(x,0) * P(cos(c_r * M_PI / 180),sin(c_r* M_PI / 180));
		p += add;
		c_r -= r;
	}

	cout << (int)p.real() << endl << (int)p.imag() << endl;

	return 0;
}

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

int main() {
double r,th=0,x=0,y=0,kaku=0;
char d;
while(1){
	cin>>r>>d>>th;
	if(r==0&&th==0){
		break;
	}
	x=x+r*sin(kaku*PI/180);
	y=y+r*cos(kaku*PI/180);
	kaku=th+kaku;
}
int xx,yy;
xx=x;
yy=y;
cout<<xx<<endl;
cout<<yy<<endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x=0,y=0,vec=90,dis,angle;
  for(;;){
    scanf("%lf,%lf",&dis,&angle);
    if(dis == 0 && angle == 0){break;}
    x+=dis*cos(vec*M_PI/180.0);
    y+=dis*sin(vec*M_PI/180.0);
    vec-=angle;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}

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


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r = 360;
	while (d != 0 || r != 0) {
		scanf_s("%lf,%lf", &d, &r);
		x = x + d * cos(a / 360 * 2 * pi);
		y = y + d * sin(a / 360 * 2 * pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}

C++: #include <stdio.h>
#include <math.h>
 
#define DEG2RAD(X) ((X)/180.0*3.1415926535898) 
int main(void){
    double curX,curY;
    int curDir;
    double dx,dy;
    int dAngle,dDist;
    
    curX = curY = 0;
    curDir = 0; // north
    scanf("%d,%d",&dDist, &dAngle);
    while (dDist!=0 || dAngle!=0){
        curX += dDist * sin(DEG2RAD(curDir));
        curY += dDist * cos(DEG2RAD(curDir));
        curDir += dAngle;
        scanf("%d,%d",&dDist, &dAngle);
    } 
    printf("%d\n%d\n", (int)curX, (int)curY);
    return 0;
}

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

int main()
{
	int x=0,y=0,tmp_y = 0;
	double X=0,Y=0;
	char dummy;
	while(cin >> x >> dummy >> y){
		if(!x && !y)break;

		X += x*cos(tmp_y*3.14/180);
		Y += x*sin(tmp_y*3.14/180);

		tmp_y = y;
	}

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