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 <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-9;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  P pos(0,0);
  int angle = 90;
  while(1) {
    int dl,dangle;
    scanf("%d,%d", &dl, &dangle);
    if(dl == 0 && dangle == 0) break;
    P dpos = polar(dl,angle*M_PI/180);
    pos += dpos;
    angle -= dangle;
  }
  printf("%d\n%d\n",(int)pos.X,(int)pos.Y);
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
	int A, B, angle=90;
	double x=0, y=0;

	const double PI = 3.14159265358979;
	for(;;){
		scanf("%d,%d", &A, &B);
		if(A==0 && B==0) break;
		x+=cos(angle*PI/180)*A;
		y+=sin(angle*PI/180)*A;
		angle -= B;
	}
	printf("%d\n%d\n", (int)x, (int)y);
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
 
using namespace std;
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double x = 0, y = 0;
	double m, d;
	char c;
	double next = 0;
	while(cin >> m >> c >> d && m != 0 && d != 0){
		double rad = (90 - next) / 180.0 * M_PI;
		x += m * cos(rad);
		y += m * sin(rad);
		next += d;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){
    double x=0,y=0,a,b,an=90;
    char c;
    while(cin>>a>>c>>b){
        if(a==0&&b==0)break;
        x+=a*cos(an/180.0*M_PI);
        y+=a*sin(an/180.0*M_PI);
        an-=b;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}

C++: // 2011/07/12 Tazoe

#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;

int main()
{
	double x = 0.0;
	double y = 0.0;
	int ang = 90;

	while(true){
		string str;
		cin >> str;

		for(int i=0; i<str.size(); i++)
			if(str[i]==',')
				str[i] = ' ';

		istringstream ist(str);
		int d, r;
		ist >> d >> r;
		if(d==0&&r==0)
			break;

		x += (double)d*cos(M_PI*(double)ang/180.0);
		y += (double)d*sin(M_PI*(double)ang/180.0);
		ang -= r;
	}

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

	return 0;
}

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

#define PI 3.14159265

using namespace std;

int main(){
  double theta,theta_sum;
  double x,x_sum,y_sum;
  
  y_sum =0;
  scanf("%f,%f",&x,&theta);
  x_sum = x,theta_sum = theta;
  while(scanf("%f,%f",&x,&theta) && x != 0 && theta != 0){
    x_sum += x*sin(theta_sum * PI / 180);
    y_sum += x*cos(theta_sum * PI / 180);
    theta_sum += theta;
  }

  cout << floor(x_sum) << endl << floor(y_sum) << endl;

  return 0;

}

C++:  
  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 const double pi=3.14159265;
 
 int main()
 {
   int step,degree;
   double x,y;
   x=0;
   int count=0;
   double final_degree=0;
   char temp;
   while(cin>>step>>temp>>degree)
   {
     if(step==0&&degree==0) break;
     else
     {
       x=x+sin(final_degree/180*pi)*step;
       y=y+cos(final_degree/180*pi)*step;
       final_degree+=degree;
     }                        
   }
   printf("%d\n%d\n",(int)x,(int)y);
   //while(1);      
   return 0;    
 }

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

#define PIE 3.14159265358979323846264 
#define ANG PIE/180.0	//RADツづ可陛渉環キ

using namespace std;

int main(void){

	double x,y,angle,step,dir;
	
	x=y=angle=0.0;
	
	while(1){
		
		scanf("%lf,%lf",&step,&dir);
		if(step==0&&dir==0){
			break;
		}
		
		x=x+step*sin(angle*ANG);
		y=y+step*cos(angle*ANG);
		
		angle=angle+dir;
	}	
	
	cout<<(int)x<<endl<<(int)y<<endl;

	return 0;
}

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%d\n", (int)x, (int)y);
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

const double EPS = 0.000000001;

int main(){
	
	int a,b;
	double angle = M_PI/2;
	P pos = P(0,0);
	
	while(scanf("%d,%d",&a,&b)){
		if(a==0 && b==0)break;
		pos += P(cos(angle),sin(angle))*(double)a;
		angle += b/180.0*M_PI;
	}
	
	printf("%d %d\n",int(-pos.X-0.5+EPS),int(pos.Y-0.5+EPS));
}

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

#define PI 3.1415926535897932384

using namespace std;

int main() {
	double x = 0, y = 0;
	int t = 90;
	
	while (1) {
		int d, it;
		scanf("%d,%d", &d, &it);
		if (d==0 && it==0) break;
		
		x += d * cos((double)t * PI/180.);
		y += d * sin((double)t * PI/180.);
		
		t -= it;
	}
	
	cout << (int)x << endl << (int)y << endl;
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define M_PI 3.14159265358979323846

using namespace std;

typedef struct location {
        double x, y;
        int deg;

        location():
                x(0.0), y(0.0), deg(0)
                {
                }
} location;

int main()
{
        location loc;
        int d, a;

        while (true) {
                scanf("%d,%d", &d, &a);
                if (d == 0 && a == 0)
                        break;
                loc.x += d * sin(loc.deg * M_PI / 180);
                loc.y += d * cos(loc.deg * M_PI / 180);
                loc.deg += a;
        }
        cout << static_cast<int>(loc.x) << endl;
        cout << static_cast<int>(loc.y) << endl;

        return 0;
}