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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  double x=0, y=0;
  int direction = 90;
  int distance,angle;
  char comma;
  while(true){
    cin >> distance >> comma >> angle;
    if(distance == 0 && angle == 0) break;

    x += distance * cos(direction * M_PI/180.0);
    y += distance * sin(direction);
    direction -= angle;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const double PI = acos(-1.0);

int main()
{
	double X = 0.0,Y = 0.0;
	int A,B,R = 90;
	while(scanf("%d,%d",&A,&B),(A || B)){
		X += A * cos(R * PI / 180.0);
		Y += A * sin(R * PI / 180.0);
		R -= B;
		if(R > 180) R -= 360;
		if(R < -180) R += 360;
	}

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

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
 
int main(){
    double a;
    double b;
    double now=90;
    double x=0,y=0;
    double PI=3.14159265358;
    while(1){
        scanf("%lf,%lf",&a,&b);
        if(a==b&&b==0)break;
        x+=cos(now*PI/180)*a;
        y+=sin(now*PI/180)*a;
        now-=b;
    }
    printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include <cstdio>
#include <algorithm>
#include <complex>

using namespace std;

using Point=complex<double>;

static const double PI=3.141592653589793;

int main() {
    Point arg=polar(1.0, PI/2);
    Point target=0.0+0.0i;
    while (true) {
        double d, a;
        scanf("%lf, %lf", &d, &a);

        if (d == 0.0 && a == 0.0)
            break;

        target += d*arg;
        arg *= polar(1.0, -a*PI/180);
    }

    int x=target.real(), y=target.imag();

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define PI 3.14159265358979323846264

using namespace std;

int main()
{
	double x=0.0,y=0.0;
	int a,b,theta=90;

	scanf("%d,%d",&a,&b);
	while(a!=0 && b!=0){
		x+=a*cos(theta%360*PI/180.0);
		y+=a*sin(theta%360*PI/180.0);

		theta-=b;
		scanf("%d,%d",&a,&b);

	}

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

	return 0;
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a,b;
	char c;
	double x=0, y=0, r=0;
	while(1){
		cin>>a>>c>>b;
		if(a==0&&b==0) break;
		x+=a*sin((pi()*r)/180);
		y+=a*cos((pi()*r)/180);
		r+=b;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
}

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

 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=M_PI/2.0;
        int l,r;
        while(true){
                cin >> l;
		cin.ignore();
		cin >> r;
                if(!(l|r))
                        break;
                x+=l*cos(nr);
                y+=l*sin(nr);
                nr-=r*M_PI/180.0;
        }
        cout << (int)x << ' '<< (int)y <<  endl;
return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	char c;
	int deg = 90;
	P crt(0, 0);
	for (int x, y; cin >> x >> c >> y, (x | y) != 0; ) {
		P v = polar(1.0, deg * 3.141592 / 180);
		crt += v * (double)x;
		deg -= y;
	}
	cout << trunc(crt.real()) << endl << trunc(crt.imag()) << endl;
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){
	int r, ang;
	double x=0, y=0;

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

		x += r * sin(ang*M_PI/180);
		y += r * cos(ang*M_PI/180);
	}

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

	return 0;
}

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

double PI = 3.141592653589793238;

int main() {
	double x = 0.0, y = 0.0, dir = PI / 2;
	while (true) {
		int d, a;
		std::scanf("%d,%d", &d, &a);
		if (d == 0 && a == 0) break;
		x += std::cos(dir) * d;
		y += std::sin(dir) * d;
		dir -= a * PI / 180;
	}
	int ix = x, iy = y;
	std::cout << ix << std::endl << iy << std::endl;
	return 0;
}

C++: #include<iostream>
#include<cmath>
#define PI 3.14159265359

using namespace std;

int main(){
  int d, a = 90, a2; 
  double x,y;
  char c;
  while(cin >> d >> c >> a2){
    if(d == 0 && a == 0) break;
    else{
      double rad = a * (PI / 180.0);
      x += d * cos(rad);
      y += d * sin(rad);
      a += a2;
    }
  }
  cout << -(int)x << "\n" << (int)y << endl;
}

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

int main(){
    int d, t;
    double x=0,y=0;
    double angle=90;
    while(1){
        char c;
        cin>>d>>c>>t;
        if(d==0&&t==0)
            break;
        x+=d*cos(angle/180*acos(-1));
        y+=d*sin(angle/180*acos(-1));
        angle-=t;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
}

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);

	return 0;
}