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++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;


int main(){
	double a,b;char c;
	double x=0,y=0,sita=0;
	while(cin>>a>>c>>b){
		
		if(a==0&&b==0)break;
		x+=cos((sita/180.0)*M_PI)*a;
		y+=sin((sita/180.0)*M_PI)*a;
		sita+=b;
		
		
	}
	cout<<(int)y<<endl;
	cout<<(int)x<<endl;
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>

using namespace std;

#define PI 3.141592654

struct point{
	double x;
	double y;
};

struct input{
	double length;
	double theta;
};

double get_radian( double theta_deg );
ostream& operator << ( ostream& s , point& p );

int main(void)
{
	input data;
	point goal = { 0.0 , 0.0 };
	double theta = 90;

	while(1)
	{
		scanf("%lf , %lf" , &data.length , &data.theta );
		if( data.length == 0 && data.theta == 0 ) break;

		goal.x += data.length * cos( get_radian(theta) );
		goal.y += data.length * sin( get_radian(theta) );

		theta -= data.theta;
	}
	cout << goal;
}

double get_radian( double theta_deg )
{
	return theta_deg*PI/180;
}

ostream& operator << ( ostream& s , point& p )
{
	return s << int(p.x) << endl << int(p.y) << endl;
}

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

int main()
{
	double PI = atan(1.0)*4;
	cout << PI << endl;
	double a = 90;
	double x=0, y=0;

	while ( true )
	{
		char c;
		int r,t;
		cin>>r>>c>>t;
		if ( r==0 && t==0 )
			break;

		x += r*cos(a/360.*2*PI);
		y += r*sin(a/360.*2*PI);
		a -= t;
	}

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

C++: #include <iostream>

static const double M_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 * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		//turn clockwise
		direction -= deg;

	}

	i_x = x;
	i_y = y;

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

	return 0;
}

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

using db = double;
const db pi = 4 * atan(1);

void p(db x) {
	if(x >= 0)
		cout << int(x + 1e-9) << '\n';
	else
		cout << int(x - 1e-9) << '\n';
}

int main() {
	cout << fixed << setprecision(0);
	ios :: sync_with_stdio(false);
	db d, t; char c;
	db x = 0, y = 0, a = 90;
	while(cin >> d >> c >> t) {
		x += d * cos(a / 180 * pi);
		y += d * sin(a / 180 * pi);
		a -= t;
	}
	p(x); p(y);
	return 0;
}

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

int main(void){
	int deg=0;
	int a,b;
	double x,y;

	while(scanf("%d,%d",&a,&b),a||b){
		x+=a*cos((double)deg/180.0*PI);
		y+=a*sin((double)deg/180.0*PI);
		deg+=b;
	}
	cout<<(int)y<<endl<<(int)x<<endl;
	return 0;
}

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

using namespace std;

#define PI 4 * atan(1.0)

int main(void){
	int w, r, d = 0;
	double x = 0, y = 0;
	while(1){
		scanf("%d%*c%d%*c",&w,&r);
		if(w == 0 && r == 0){
			break;
		}
		x += w * cos(d * PI / 180);
		y += w * sin(d * PI / 180);
		d += r;
	}
	printf("%d\n%d\n",(int)y,(int)x);
	return 0;
}

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

using namespace std;

int main(){
	double sumX = 0;
	double sumY = 0;
	double d,rad = 3.1415/2;
	double theta;
	while(1){

		cin >> d ;
		getchar();
		cin >> theta;
		if(d == 0 and theta == 0) break;
		sumX += d * cos(rad);
		sumY += d * sin(rad);
		rad -= (3.1415*theta)/180.0;
	}

	cout << (int)sumX << " " << (int)sumY << endl;
	return 0;
}

C++: #include <cmath>
#include <cstdio>
double x, y, a; int s, t;
int main() {
	while(~scanf("%d,%d", &s, &t)) {
		x += s * cos(a);
		y += s * sin(a);
		a += t / 180.0 * 3.14159265358979;
	}
	printf("%d\n%d\n", (int)y, (int)x);
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(void){
  int w,a,ang=90;
  double x=0,y=0,r;
  while(1){
    scanf("%d,%d",&w,&a);
    if(w==0 && a==0)break;
    r=(double)ang/180.0*M_PI;
    x+=cos(r)*w;
    y+=sin(r)*w;
    ang-=a;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

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

#define pi 2*acos(0.0)

int main()
{
    float a , b , u=0 , x=0 , y=0 ;
    char ch ;
    while(scanf("%f%c%f",&a,&ch,&b)!=EOF)
    {
        if(a==0 && b==0) break ;
        x+=a*sin(u*pi/180.0) ;
        y+=a*cos(u*pi/180.0) ;
        u+=b ;
    }
    x=(int)x ; y=(int)y ;
    printf("%.0lf\n%.0lf\n",x,y) ;
    return 0 ;
}

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

#define PI 3.1415927

int main(){
	
	double n , angle , red = 90 ;
	double x=0 , y=0 ;
	
	while(1){
		scanf("%lf,%lf",&n ,&angle ) ;
		if( n==0 && angle==0 ) break ;
		
		x += n*cos(PI/180 * red) ;
		y += n*sin(PI/180 * red) ;
		
		red -= angle ;
	}
	
	int ans_x = x ;
	int ans_y = y ;
	
	printf("%d\n%d\n",ans_x ,ans_y) ;
	
return 0 ;
}

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

const double PI = acos(-1);

int main() {
  int w;
  int cAng = 90, ang;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>ang && w != 0 && ang != 0) {
    x += w * cos(cAng*PI/180.0), y += w * sin(cAng*PI/180.0);
    cAng -= ang;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}