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>
#include <cstdio>
using namespace std;

int main() {
  int w;
  int cAng = 90, ang;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>ang && w != 0 && ang != 0) {
    x += w * cos(cAng*M_PI/180.0), y += w * sin(cAng*M_PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

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

int main(){
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(cin >>x>> c >> y){
		if(x==0&&y==0) break;
		sum_y += x*cos(theta*M_PI/180);
		sum_x += x*sin(theta*M_PI/180);
		theta += y;
	}
	cout << (int)sum_x<<endl;
	cout <<(int)sum_y<<endl;

}

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

#define M_PI 3.14159265358979

int main(void)
{
    int step, dig;
    double x, y, angle;

    x = 0;
    y = 0;
    angle = 0;

    while (1){
        scanf("%d,%d", &step, &dig);

        if (step == 0 && dig == 0){
            break;
        }

        x += (double)step * sin(angle * (M_PI / 180));
        y += (double)step * cos(angle * (M_PI / 180));
        angle += (double)dig;
    }

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

    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <numeric>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	double l, a, b, x = 0, y = 0, c = 0;
	while (scanf("%lf,%lf", &l, &a)){
		if (l == 0 && a == 0)break;
		if (c == 0){
			y += l;
		}
		else{
			x += l*sin(b / 180.0*PI);
			y += l*cos(b / 180.0*PI);
		}
		b += a;
		c++;
	}
	cout << (int)x << "\n" << (int)y << "\n";
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x = 0, y = 0, r = M_PI/2.0;
    int a, b;
    char delim;
    while (cin >> a >> delim >> b, a||b) {
        x += a * cos(r);
        y += a * sin(r);
        r -= b * M_PI / 180.0;
    }
    cout << (int)x << "\n";
    cout << (int)y << "\n";

    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;	
		cout << posX << ":" << posY << endl;
	}
	printf("%.0f %.0f\n",posX,posY);
}

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

int main(void)
{
	float len;
	float ang, angin;
	float x, y;
	
	x = 0;
	y = 0;
	ang = 90;
	while (1){
		scanf("%f,%f", &len, &angin);
		
		if (len == 0 && angin == 0){
			break;
		}
		
		y += (sin(ang / 180 * M_PI) * len);
		x += (cos(ang / 180 * M_PI) * len);
		
		ang -= angin;
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return (0);
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  double K,x,y;
  int tmpgo,tmprag;
  x = 0; y =0; K = 90;
  for(int count=0;;count++){
    scanf("%d,%d",&tmpgo,&tmprag);
    if(tmpgo == 0 && tmprag == 0){
      break;
    }
    x += tmpgo * cos(K*p /180);
    y += tmpgo * sin(K*p /180);
    K = K - tmprag;
  }
  cout << (int)x << endl << (int)y << endl;

}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int walk, angle;
	double x = 0, y = 0;
	double rad = 90 * (M_PI / 180.0);
	double theta = 90;
	while(scanf("%d,%d", &walk, &angle), walk || angle) {
		y += walk * sin(rad);
		x += walk * cos(rad);
		theta = theta - angle;
		rad = theta * (M_PI / 180.0); 
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

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

#define PI 3.141592654

using namespace std;

int main(void)
{
	double x = 0;
	double y = 0;
	int  step, d_angle;
	int  angle = 90;

	while(1)
	{
		scanf( "%d,%d",&step , &d_angle );
		if( step == 0 && d_angle == 0 ) break;

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

		angle -= d_angle;
	}

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

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
int i,j;
char c;
double x,y,a,pi=3.1415926;
x=y=0;a=90*pi/180;
while(1){
cin>>i>>c>>j;
if(i==0&&j==0)break;
x+=i*cos(a);
y+=i*sin(a);
a-=j*pi/180;
}
cout<<trunc(x)<<endl;
cout<<trunc(y)<<endl;
return 0;
}

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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c*3.14159265/180)*a;
		y += sin(c*3.14159265/180)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x <<' '<< y << 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;
	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;
	}
	int x1=x,y1=y;
	cout<<x1<<endl<<y1<<endl;
		
	
}

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

int main()
{
  int n;
  double x, y, deg, rad;
  
  x = y = deg = rad = 0;
  while (1){
    scanf("%d,%lf", &n, &deg);
    if (n == 0 && deg == 0){
      break;
    }
    x += cos(rad) * n;
    y += sin(rad) * n;
    deg = deg / 180 * M_PI;
    rad += deg;
  }

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

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define PI 3.141592
int main(void) {
    double x = 0, y = 0, theta = 0;
    while (1) {
        int d, dir;
        scanf("%d,%d", &d, &dir);
        if (d == 0 && dir == 0) break;
        y += cos((PI * theta) / 180) * d;
        x += sin((PI * theta) / 180) * d;
        theta = (theta + dir);
    }
    cout << (int)(x) << endl;
    cout << (int)(y) << endl;
    return 0;
}