Go: package main

import (
	"fmt"
	"math"
	"strings"
	"strconv"
)

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), int(y))
}

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

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=90;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos(prad*pi/180);
		dy=d*sin(prad*pi/180);
		x+=dx;
		y+=dy;
		prad=prad-rad;
	//	cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	//while(1);
	return 0;
}

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

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

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

using namespace std;

static const double PI = 3.141592;

int main()
{
    int m,r,dr;
    double x = 0.0, y = 0.0;
    r = 0;
    while(scanf("%d,%d", &m, &dr) == 2 && (m != 0 || dr != 0)) {
        double dx = (m * cos(r * PI / 180.0)), dy = (m * sin(r * PI / 180.0));
        x += dx; y += dy;
        r = (r + dr + 360) % 360;
    }
    cout << (int)y << endl;
    cout << (int)x << endl;
}

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

using namespace std;

int main() {
	const double Pi = 3.14159265358979323846;
	// 初期値は北なので、９０度
	int angle = 90;
	double x = 0, y = 0;
	while (true) {
		// r:距離 a回転角
		int r, a;

		cin >> r;
		cin.ignore();
		cin	>> a;
		if (r == 0 && a == 0) {
			break;
		}

		double dx = r * cos(angle / 180.0 * Pi);
		double dy = r * sin(angle / 180.0 * Pi);

		x += dx;
		y += dy;

		angle -= a;
		if (angle >= 360) {
			angle %= 360;
		}
		else if (angle < 0) {
			angle += 360;
		}

	}
	cout << static_cast<int>(x) << endl << static_cast<int>(y) << endl;
}

C++: #include <iostream>
#include <math.h>
#include <stdlib>
using namespace std;
#define PI 3.14159265
int main()
{
    double x=0,y=0;
	int r,dth,th=0;
	while(true){
		scanf("%d,%d",&r,&dth);
		if(!r&&!dth)break;
		x+=r*sin((double)th*PI/180);
		y+=r*cos((double)th*PI/180);
		th+=dth;
	}
	cout<<int(x)<<endl;
	cout<<int(y)<<endl;
    return 0;
}

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

using namespace std;

int main()
{
	double x = 0, y = 0;
	int hosuu, kakudo;
	char tmp;
	int theta = 90;

	while ( 1 )
	{
 		cin >> hosuu >> tmp >> kakudo;
		if ( hosuu == 0 && kakudo == 0 )
		{
			break;
		}

		y = y + hosuu * sin( theta * M_PI / 180 );
		x = x + hosuu * cos( theta * M_PI / 180 );

		theta = theta - kakudo;
	}

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

	return 0;
}

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


int main()
{
	int x = 0, y = 0;
	double d = 0, a = 90, r;
	while (d != 0 || r != 0) {
		cin >> d >> r;
		x = x + d * cos(a / 2 / pi);
		y = y + d * sin(a / 2 / pi);
		a = a + r;
	}
	cout << x << endl << y << endl;
    return 0;
}

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

int main()
{
    char comma;
    double x = 0, y = 0, env = 0;
    for (double d, t; cin >> d >> comma >> t && (d || t);) {
        x += sin(env) * d;
        y += cos(env) * d;
        env += t * M_PI / 180;
    }
    cout << (int) x << endl;
    cout << (int) y << endl;

    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n, t, a = 90;
	char c;
	double x = 0.0, y = 0.0;
	while (cin >> n >> c >> t, n || t)
	{
		x += n * cos((double)a*3.14159265/180);
		y += n * sin((double)a*3.14159265/180);
		a -= t;
	}
	cout << (int)x << endl << (int)y << endl;
}

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

double to_radian(int angle) {
  return double(angle) * PI / 180.0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int len,angle;
  double x,y,rad;
  x = y = 0.0;
  rad = to_radian(90);
  while(scanf("%d,%d",&len,&angle)) {
    if((len | angle) == 0) break;
    x += len * cos(rad);
    y += len * sin(rad);
    rad = rad - to_radian(angle);
  }
  cout << int(x) << endl;
  cout << int(y) << endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int d, r;
	int w = 0;
	double  x = 0, y = 0;
	char n;
	 

	 while(1){

	 	cin >> d >> n >> r;
	 	
	 	if(d == 0 && n == ',' && r == 0) break;
	 	
	 	x += d * sin(w * M_PI / 180);
	 	y += d * cos(w * M_PI / 180);
	 	w += r;
	 	
	 
	 	
	 }
	 cout << endl;
	 cout << (int)x << endl << (int)y << endl;
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  double d, t, x, y, n;
  x = y  = 0;
  n = 90;
  while(scanf("%lf,%lf", &d, &t) && (d || t)){
    y += d * sin(n * M_PI / 180);
    x += d * cos(n * M_PI / 180);
    n -= t;

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

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

typedef long double ldouble;

const ldouble PI = acos(-1.0);
const ldouble eps = 1e-10;

ldouble mysin(ldouble x) {
    ldouble ret = 0.0, now = x, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 2) * (2 * i + 3);
    }
    return ret;
}

ldouble mycos(ldouble x) {
    ldouble ret = 0.0, now = 1, tt = x * x, k = 1;
    for(int i = 0; i < 1000; i++) {
        ret += now / k;
        now *= (-tt);
        k *= (2 * i + 1) * (2 * i + 2);
    }
    return ret;
}
int main()
{
    //printf("%.20f %.20f\n", (double)mycos(PI / 3), cos(PI / 3));
	int d,t;
	ldouble x=0,y=0;
    int dir = 0;
	while(scanf("%d%*c%d", &d, &t) &&d!=0&&t!=0)			//霎灘?0,0扈捺據
	{
	    while(dir >= 360) dir -= 360;
	    while(dir < 0) dir += 360;
		x -= d * sin(((ldouble)dir) * PI / 180.0);						//隶。邂?		y += d * cos(((ldouble)dir) * PI / 180.0);
	    dir -= t;
	}
    long long ox, oy;
    ox = x, oy = y;
	printf("%lld\n%lld\n", ox, oy);					//霎灘?

	return 0;
}

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

typedef complex<double> Point;

#define X real()
#define Y imag()
#define PI 3.1415926535

Point ans;
Point v = Point(0, 1);

int main() {
  while (1) {
    int a, b;
    scanf("%d,%d", &a, &b);
    if (a == 0 && b == 0) break;
    ans += double(a) * v;

    double t = double(-b)*PI/180;
    v *= Point(cos(t), sin(t));
  }

  printf("%d\n", int(ans.X));
  printf("%d\n", int(ans.Y));
}

C++: #define _USE_MATH_DEFINES
#include<cmath>
#include<iostream>
int main()
{
	double x = 0, y = 0;
	int a = 90;
	while (true)
	{
		int di, ai;
		char temp;
		std::cin >> di >> temp >> ai;
		if (di == 0 && ai == 0)
		{
			break;
		}
		x += di * cos(a * M_PI / 180);
		y += di * sin(a * M_PI / 180);
		a -= ai;
	}
	std::cout << static_cast<int>(x >= 0 ? floor(x) : ceil(x)) << std::endl;
	std::cout << static_cast<int>(y >= 0 ? floor(y) : ceil(y)) << std::endl;
	return 0;
}

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

#define PI 3.1415926535

int main(void){
    double dst,angl,angl_now;
    double x,y;
    x=y=0;
    angl_now=90;
    char ch;
    while(std::cin>>dst>>ch>>angl){
        if(dst==0 && angl==0) break;
        x+=dst*cos(PI/180*angl_now);
        y+=dst*sin(PI/180*angl_now);
        angl_now-=angl;
    }
    std::cout<<(int)x<<std::endl<<(int)y<<std::endl;
    return 0;
}