Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var r, d float64
        var x, y, rad float64
        rad = math.Pi / 2
        for {
                _, err := fmt.Scanf("%f,%f", &d, &r)
                if err != nil {
                        break
                }
                if r == 0.0 && d == 0.0 {
                        break
                }

                x += d * math.Cos(rad)
                y += d * math.Sin(rad)
                rad -= r * math.Pi / 180
        }

        fmt.Printf("%d\n", int(x))
        fmt.Printf("%d\n", int(y))
}

C++: //0016 Treasure Hunt

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

template<class T>
T DigToRad(T x)
{
	return x / T(180) * 3.14159265358979323846264338327950;
}


int main(void)
{
	double x, y;
	double d, dd, r;
	char dummy;

	x = y = 0;
	d = 90;
	//üÍÍR}ÅæØçêÄ^¦çêé
	while(cin >> r >> dummy >> dd, r)
	{
		x += r*cos(DigToRad(d));
		y += r*sin(DigToRad(d));
		//³ÌÈçEñè
		d -= dd;

		cout << '\t' << x << '\t' << y << endl;
	}
	//®ðoÍ
	cout << (int)x << endl << (int)y << endl;
}

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(){

	int a; int b; double c=90; double x=0; double y=0;
	while(true){
	cin >> a >> b;
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

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

	return 0;

    }

C++: /*AOJ 0016*/

#include<iostream>

#define M_PI 3.14159265

using namespace std;

double changeDegToRad(double deg){

	return deg*M_PI/180.0;

}

int main(){

	double x = 0,y = 0;
	double deg = 0,walk = 0;
	double rad = M_PI/2.0;
	while(1){
		scanf("%lf,%lf",&walk,&deg);


		if(deg==0&&walk==0){
			break;
		}

		x += walk * cos(rad);
		y += walk * sin(rad);

		rad -= changeDegToRad(deg);

	}

	cout<<(int)x<<" "<<(int)y<<endl;
	return 0;
}

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

#define PI 3.1415926535898

int main() {
	int dir=90, rad, adv;
	double x=0.0, y=0.0;
	while (scanf("%d%*c%d",&adv,&rad)&&adv!=0.0&&rad!=0.0) {
		x += cos(dir*(PI/180))*(double)adv;
		y += sin(dir*(PI/180))*(double)adv;
		dir -= rad;
		if (dir < 0) dir += 360;
	}
	int X = (int)x;
	int Y = (int)y;
	printf("%d\n%d\n",X,Y);
}

C++: #include<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>
#include<algorithm>

using namespace std;
int main(void)
{
	double x = 0,y = 0;
	double hosu,kakudo;
	double kakudos = 90;
	while(scanf("%lf,%lf",&hosu,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		printf("%lf\n",cos(kakudos * M_PI / 180) * hosu);
		kakudos -= kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	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("%.0lf\n%.0lf\n",x,y);
   //while(1);      
   return 0;    
 }

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

using namespace std;

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

	while(1) {
		cin >> m >> angle;
		if(m==0&&angle==0)
			break;
		x+=m*cos((double)(deg*PI/180));
		y+=m*sin((double)(deg*PI/180));
		deg-=angle;
	}

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

	return 0;

}

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

static const double PI = 6*asin(0.5);

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore(); //read ,
		cin >> deg;

		if(len == 0 && deg == 0) break;

		//proceed
		x += len * cos(direction * PI / 180);
		y += len * sin(direction * PI / 180);
		
		//turn clockwise
		direction -= deg;

	}

	i_x = x;
	i_y = y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  string s;
  double x = 0.0, y = 0.0, angle = 90.;
  while(true){
    cin >> s;
    int d = 0, a = 0;
    rep(i, s.size()){
      if(s[i] == ','){
        d = stoi(s.substr(0, i));
        a = stoi(s.substr(i+1, s.size()));
        break;
      }
    }
    if(d == 0 && a == 0)break;
    x += double(d) * cos(angle * M_PI/180.);
    y += double(d) * sin(angle * M_PI/180.);
    angle -= a;
  }
  cout << int(x) << endl;
  cout << int(y) << endl;
	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=0;

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

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

	}

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

	return 0;
}

C++: //0016
// Time-stamp: <2012-07-10 18:44:05 naga>

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define PI 3.1415926535
using namespace std;


int main(){
  int walk, deg;
  double x, y;
  int direction;

  x = y = 0;
  direction = 90;
  while(true){
    //radian = (double)(direction * PI/ 180);
    scanf("%d,%d", &walk, &deg);
    if(!walk && !deg){
      break;
    }
    
    x += (double)walk * cos(direction * PI / 180);
    y += (double)walk * sin(direction * PI / 180);

    // 向きを変える。角度を360以下に
    direction += deg;
    if(direction > 360){
      direction = direction - 360;
    }
  }

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

  return 0;
}

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

vector<int> X,Y;
int main(){
	int x=1,y=0;
	while(1){
		scanf("%d,%d",&x,&y);
		if(!(x||y)) break;
		X.push_back(x);
		Y.push_back(y);
	}
	double nx=0,ny=0,na=0;
	for(int i=0;i<X.size();i++){
		nx+=(double)X[i]*sin(na*M_PI/180.0);ny+=(double)X[i]*cos(na*M_PI/180.0);
		na+=(double)Y[i];
	}
	cout<<(int)nx<<endl<<(int)ny<<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;
	}
	printf("%d\n%d\n",(int)x,(int)y);
		
	
}