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<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define PI (3.1415926535)
#define EPS (1e-10)

int main(){
  double a,b;
  P pos(0.0,0.0);
  P ang(0.0,1.0);
  while(scanf("%lf,%lf",&a,&b), a+b){
    double th = - (b / 180.0) * PI;
    pos = pos + ang * a;
    ang = ang * P(cos(th), sin(th));
  }
  cout << (int)pos.real() << endl << (int)pos.imag() << endl;
  return 0;
}

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

double PI = 3.141592;

int main(void) {

    double x = 0;
    double y = 0;
    double r = 0;
    double a = 90;
    double d = 0;
    while(true){

        scanf("%lf,%lf", &r, &d);
        if( r == 0 && d == 0 ) break;

        x += r * cos( a * PI / 180 );
        y += r * sin( a * PI / 180 );
        // cerr << x << " " << y << endl;
        a -= d;
    }
    cout << (int)x << endl << (int)y << endl;


    return 0;
}

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) a || b){

	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;

    }

C++: #include<iostream>
#include<cmath>
using namespace std;
double angle(int n){
  return n * (3.14159265358979/180);
}
int main(){
  int l,r,n=0;
  double x,y;
  x = y = 0;
  char c;
  while(cin>>l>>c>>r){
    if(l==0&&r==0) break;
    x += l*cos(angle(n));
    y += l*sin(angle(n));
    n += r; 
  }
  cout << int(y) << endl << int(x) << endl;
  return 0;
}

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

#define PI 3.1416

using namespace std;

int main(){
  int d;
  float mt=90.0*PI/180;
  float t,x,y;
  x=y=0.0;
  while(1){
    scanf("%d,%f",&d,&t);
    if(d==0&&t==0) break;
    x+=d*cos(mt);
    y+=d*sin(mt);
    mt+=-t*PI/180;
  }
  if(x<0) x+=0.5;
  if(y<0) y+=0.5;
  printf("%.0f\n%.0f",floor(x),floor(y));
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
    int a,b;
    double x = 0, y = 0, arg = 0;
    while(1) {
    	scanf("%d,%d",&a,&b);
    	if(a == 0 && b == 0) break;
    	x += a * sin(arg * (M_PI / 180.0));
    	y += a * cos(arg * (M_PI / 180.0));
    	arg += b;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

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

double rad=90.00000000000;//回転角
double x=0.0,y=0.0;//現在地
int answer_x,answer_y;
double PI=6*asin( 0.5 )/180;

int main()
{
	int a,b;
	while(scanf("%d,%d",&a,&b)!=EOF)
	{
		if(a==0&&b==0)break;
		y+=sin(rad*PI)*a;
		x+=cos(rad*PI)*a;
		rad=(rad-b);
	}
	if(x>0)answer_x=floor(x);
	else answer_x=ceil(x);
	if(y>0)answer_y=floor(y);
	else answer_y=ceil(y);
	printf("%d %d\n",answer_y,answer_x);
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Here your code !
 int r,p,f=90;
 char c;
 double x=0,y=0;
 
 while(cin>>r>>c>>p){
   if(r==0&&p==0) break;  
   
   x=x+r*cos(f*M_PI/180.0);
   y=y+r*sin(f*M_PI/180.0);
   f=f-p;
 }
 cout<<(int)x<<endl<<(int)y<<endl;
}

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

using namespace std;

double x, y;

int main()
{
	int len, in_way;
	int way = 90;
	
	while (scanf("%d,%d", &len, &in_way), len || in_way){
		double rad = way * M_PI / 180.0;
		x += cos(rad) * len;
		y += sin(rad) * len;
		
		way = (way - in_way + 360) % 360;
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return (0);
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>


const double PI = 4.0 * atan(1.0);
double ToRadian(double degree)
{
	return degree * PI/180;
}

using namespace std;


int main()
{
	int d, t;
	double x, y;
	x = y = 0;
	int totalAngle = 90;
	while (true)
	{
		scanf("%d,%d", &d, &t);
		if (d == 0 && t ==0)
			break;

		double ang = ToRadian(totalAngle);
		x += d * cos(ang);
		y += d * sin(ang);
		totalAngle -= t;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

int main() {
  int d, t;
  double x, y, theta;

  x = 0;
  y = 0;
  theta = 90;
  while (1) {
    scanf("%d,%d", &d, &t);
    if (!d && !t) break;
    x += d*cos(theta/180.0*M_PI);
    y += d*sin(theta/180.0*M_PI);
    theta -= t;
  }
  cout << ((x>=0.0) ? (int)floor(x) : (int)ceil(x)) << endl;
  cout << ((y>=0.0) ? (int)floor(y) : (int)ceil(y))<< endl;

  return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
	double D,A,x=0,y=0,r=0;
	while(scanf("%lf,%lf",&D,&A),D||A){
		x += D*sin(r/180*M_PI);
		y += D*cos(r/180*M_PI);
		r += A;
	}
	printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,P> pip;
typedef long long ll;
const int inf=(1<<31)-1;
const double pi=acos(-1);

double a,b,x=0,y=0,sit=0;
char t;

int main(){
	while(cin>>a>>t>>b){
		if(!a&&!b) break;
		x+=a*sin(sit/180*pi);
		y+=a*cos(sit/180*pi);
		sit+=b;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
}

C++: #include <bits/stdc++.h>
#define P 3.1415
using namespace std;
int main(){
  double a,b,x=0,y=0,s=0;
  while(scanf("%lf,%lf",&a,&b),a&&b){
    x+=a*cos(s*P/180);
    y+=a*sin(s*P/180);
    s+=b;
  }cout<<(int)x<<endl<<(int)y<<endl;
}

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

#define PI acos(-1.0)

using namespace std;

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

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;



int main(){
	int r, ang;
	double x=0, y=0;

	while(1){

		scanf("%d,%d", &r, &ang);
		if(r==0) break;

		x += r * cos(ang*M_PI/180);
		y += r * sin(ang*M_PI/180);

	}

	cout << x << endl << y << endl;

	return 0;
}