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>

void sepTwoNumbers(char*, int&, int&);
int char2Number(const char*, int, int);

bool inputNumber(char*);

int main(){
	double const PI = 3.141592653589793;
	double point[2] = { 0, 0 };
	int angle = 90;
	int d, a;
	char inputNumbers[10];
	while (inputNumber(inputNumbers)){
		sepTwoNumbers(inputNumbers, d, a);
		
		point[0] += d * std::cos(PI * angle / 180);
		point[1] += d * std::sin(PI * angle / 180);
		angle -= a;
	}
	std::cout << static_cast<int>(point[0]) << std::endl;
	std::cout << static_cast<int>(point[1]) << std::endl;
	return 0;
}

//入力文字から2つの文字を分離させる関数
void sepTwoNumbers(char* charOftwoNumber, int& number1, int& number2){
	int commaIndex;
	int endIndex;

	for (commaIndex = 0; charOftwoNumber[commaIndex] != ','; ++commaIndex);

	number1 = char2Number(charOftwoNumber, 0, commaIndex);

	for (endIndex = commaIndex; charOftwoNumber[endIndex] != '\0'; ++endIndex);

	number2 = char2Number(charOftwoNumber, commaIndex + 1, endIndex);
}

//文字列を数字に変換する関数
int char2Number(const char* charNumber, int startDigit, int endDigit){
	int number = 0;
	int sd = 1;
	if (charNumber[startDigit] == '-'){
		sd = -1;
		++startDigit;
	}
	for (int i = startDigit; i < endDigit; ++i){
		number *= 10;
		number += charNumber[i] - '0';
	}
	return number * sd;
}

bool inputNumber(char* inputNumbers){
	std::cin >> inputNumbers;
	if (inputNumbers[0] == '0' && inputNumbers[2] == '0'){
		return false;
	}
	else{
		return true;
	}
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

// const ll inf = INT_MAX;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	int r;
	double x=0, y=0;
	double ini = pi/2, alpha, theta;
	cout << endl;
	while(scanf("%d,%lf\n", &r, &theta)){
		if(r == 0 && std::abs(theta - 0.0) < eps){
			// printf("finished\n");
			break;
		}
		else{
			x += r*cos(ini);
			y += r*sin(ini);
			alpha = pi*theta/180;
			ini -= alpha;
		}
	}
	printf("%d\n", (int)x);
	printf("%d\n", (int)y);
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;


int main() {
    int a,b;
    int theta = 90;
    double x=0,y=0;
    int idx = 0;
    while(~scanf("%d,%d",&a,&b)) {
        if(a==0 && b==0) break;
        y+=a*sin(theta/180.0*3.1415926535);
        x+=a*cos(theta/180.0*3.1415926535);

        theta += b;
    }
    cout<<(int)-x<<endl<<(int)y<<endl;
    return 0;
}

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += (double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += -d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#define PI 3.14159265
#define RAD (PI/180)

using namespace std;

int main() {
	
	int m, angle;
	double x=0, y=0, deg=90;

	while(1) {
		scanf("%d, %d", &m, &angle);
		if(m==0&&angle==0)
			break;
		x+=(double)m*cos(deg*RAD);
		y+=(double)m*sin(deg*RAD);
		deg-=(double)angle;
	}

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

	return 0;

}

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

int main(){
  int a,pre_d=-90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += (double)a*cos(-(double)pre_d*M_PI/180);
    y += (double)a*sin(-(double)pre_d*M_PI/180);
    pre_d += d;
  }
  //std::cout << (double)a << std::endl;
  printf("%.0f\n%.0f\n",x,y);

}

C++: #include <iostream>
#include <cmath>
#define PI acos(-1)
 
using namespace std;
 
int main(){
        double x=0.0,y=0.0;
        double nr=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*PI/180.0;
        }
        cout << (int)x << ' '<< (int)y <<  endl;
return 0;
}

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

using namespace std;

int main(){
	string x;
	int d, theta;
	int direction=0;
	pair<double,double> p;
	while(cin >> x){
		sscanf(x.c_str(),"%d,%d",&d,&theta);
		p.first += d*cos(direction/360.0*2*M_PI);
		p.second += d*sin(direction/360.0*2*M_PI);
		direction += theta;
	}
	cout << (int)p.second << endl;
	cout << (int)p.first << endl;
}

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


int main(int argc, char *argv[]){
	double x=0,y=0,th=-1,d=0,dir=90;
	while(!(d==0 && th==0)){

		cin>>d; cin.ignore();cin>>th;
		x+=d*cos(dir*M_PI/180);
		y+=d*sin(dir*M_PI/180);
		
		dir-=th;

	}
	cout<<(int)x<<endl<<(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);

	return 0;
}

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

double before_degree = 0;;

int main(void){

    int length = 0,degree = 0;
    double x = 0,y = 0;
    char c;
    double pi = M_PI;
    
    while(cin >> length  >> c >> degree){
        if(length == 0 && degree == 0){
            break;
        }
        
        x += (double)(length * sin((pi * before_degree) / 180));
        y += (double)(length * cos((pi * before_degree) / 180));
        before_degree = (double)(degree + before_degree);
        
    }

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

    return 0;
}