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

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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

#define do {
#define end }

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

const long double PI = 3.141592653589793238462643383279502884L poi

int main() do
    double x = 0, y = 0 poi
    int r = 90, d, nr poi
    char comma poi
    while(read(d, comma, nr), d) do
        x += d * cos(r * PI / 180) poi
        y += d * sin(r * PI / 180) poi
        r -= nr poi
    end
    cout << (int)x poipoi << (int)y poipoi poi
    return 0 poi
end

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

int main(){

	double a,b; double c=90; double x=0; double y=0;
	while(scanf("%lf%lf",&a,&b)!=EOF){

	if(a==0 && b==0) break;
	x+=a*cos(c*M_PI/180);
	y+=a*sin(c*M_PI/180);
	c-=b;

	}

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


	return 0;

    }