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>
#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.14159265359/180);
		Y += x*sin(tmp_y*3.14159265359/180);

		tmp_y += y;
	}

	cout << (int)Y << endl << (int)X << endl;
	cin >>x;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x = 0,y = 0,dis,ang = 90,a;
  for(;;){
    scanf("%lf,%lf",&dis,&a);
    if(dis == 0 && a == 0){break;}
    x+=dis*cos(M_PI*ang/180);
    y+=dis*sin(M_PI*ang/180);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    double x=0,y=0;
    double angle=90;
    while(true){
        double a,b;
        char c;
        cin>>a>>c>>b;
        
        if(a==0&&b==0)break;
        if(b<0){b=360+b;}
        x+=a*cos(angle*M_PI/180);
        y+=a*sin(angle*M_PI/180);
        angle-=b;
        
        
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    
    return 0;
}

C++: #include <bits/stdc++.h>
#define P 3.14159265
using namespace std;
int main(){
  double a,b,x=0,y=0,s=0;
  while(scanf("%lf,%lf",&a,&b),a&&b){
    x+=a*cos(s*M_PI/180);
    y+=a*sin(s*M_PI/180);
    s+=b;
  }cout<<(int)y<<endl<<(int)x<<endl;
}

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

int main() {
	int d,a,kakudo=0;
	long double x=0, y=0;
	while (1) {
		scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0)
			break;
		y += d*cos(kakudo*PI / 180.0);
		x += d*sin(kakudo*PI / 180.0);
		kakudo = (kakudo + a) % 360;
	}
	cout << (int)x << endl << (int)y ;
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdio.h>
 
using namespace std;

//-------------------------------------------------------------------------
// geometric library
 
namespace geometry {
 
struct point {
    double x;
    double y;
};
 
struct circle {
    point center;
    double radius;
};
 
struct line { // ax + by + c = 0
    double a;
    double b;
    double c;
};
 
std::istream& operator >> (std::istream& is, point& p)
{
    is >> p.x >> p.y;
    return is;
}
 
bool operator == (const point& p1, const point& p2)
{
    return p1.x == p2.x && p1.y == p2.y;
}
 
///! 2点の距離
double get_distance(const point& p1, const point& p2)
{
    return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}
 
///! 2直線の交点
bool get_crosspoint(const line& l1, const line& l2, point *result)
{
    double denominator = l1.a * l2.b - l1.b * l2.a;
    if (denominator == 0) {
        return false;
    }
    result->x = (l1.b * l2.c - l2.b * l1.c) / denominator;
    result->y = (l2.a * l1.c - l1.a * l2.c) / denominator;
    return true;
}
 
///! 2点の垂直2等分線
bool get_bisector(const point& p1, const point& p2, line *result)
{
    if (p1 == p2) {
        return false;
    }
    result->a = 2 * (p1.x - p2.x);
    result->b = 2 * (p1.y - p2.y);
    result->c = -(p1.y - p2.y) * (p1.y + p2.y) - (p1.x - p2.x) * (p1.x + p2.x);
    return true;
}
 
///! 外接円を求める
bool get_circum_circle(const point& p1, const point& p2, const point& p3, circle *result)
{
    double a = get_distance(p1, p2);
    double b = get_distance(p2, p3);
    double c = get_distance(p3, p1);
 
    // 半径の公式
    result->radius = a * b * c / sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
 
    line line_p1p2;
    line line_p2p3;
 
    // 頂点の垂直2等分線の交点が外心
    return get_bisector(p1, p2, &line_p1p2) &&
           get_bisector(p2, p3, &line_p2p3) &&
           get_crosspoint(line_p1p2, line_p2p3, &result->center);
}
 
} // namespace geometry

using namespace geometry; 


int main(void)
{
	int steps, dtheta;
	char comma;
	double theta;
	point p;

	p.x = p.y = 0.0;
	theta = 90.0;

	while (cin >> steps >> comma >> dtheta) {
		assert(comma == ',');

		if (steps == 0 && dtheta == 0) {
			break;
		}

		p.x += steps * cos(theta * M_PI / 180.0);
		p.y += steps * sin(theta * M_PI / 180.0);
		theta -= dtheta; // 正の数は右に回る
	}

	cout << (int)p.x << endl << (int)p.y << endl;
}

C++: #include<stdio.h>
#include<math.h>
using namespace std;
int main(){
double x,y,s;
int n,k;
x=y=s=0;
while((scanf("%d,%d",&n,&k)),n!=0){
x=x+n*cos(M_PI*s/180);
y=y+n*sin(M_PI*s/180);
s=s+k;
}
printf("%d\n%d\n",int(y),int(x));
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<math.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double rad = 90 / 180 * M_PI, north = 0, east = 0;
    double inputMeter, inputAngle;
    char garbage;

    while(cin >> inputMeter >> garbage >> inputAngle, inputMeter){
            east+= cos(rad) * inputMeter;
            north+= sin(rad) * inputMeter;
        rad+= inputAngle / 180 * M_PI;
    }
    cout << static_cast<int>(north) << endl << static_cast<int>(east) << endl;
}

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

#define PI 3.1415926535897932386

int main()
{
	int x, r;
	double X = 0, Y = 0, rad = 90;

	while(1){
		//üÍ
		cin>>x;
		cin>>r;

		//0¾Á½çIíé
		if(x == 0 && r == 0){
			break;
		}

		X += x * cos(rad * PI/180);
		Y += x * sin(rad * PI/180);

		rad -= r;
	}
	
	X = (int)X;
	Y = (int)Y;

	cout<<X<<endl<<Y;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main( void )
{
  double PI = 3.14159265358979323846264338327950288;
  double x=0,y=0,d,a,b=PI/2;
  char c;
  while( 1 ){
    cin >> d >> c >> a;
    if( d == 0 && a == 0 ) break;
    x += d * cos(b);
    y += d * sin(b);
    b -= a / 360 * 2 * PI;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

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

const double PI = 3.14159265359;

using namespace std;

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90; //????????????????????????
	scanf("%d,%d", &d, &a);	

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca -= a;
		scanf("%d,%d", &d, &a);	
		
	} while(d != 0 || a!= 0);

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

	return 0;
}