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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  double x=0.0, y=0.0;
  int direction = 90;
  int distance,angle;
  char comma;
  while(true){
    cin >> distance >> comma >> angle;
    if(distance == 0 && angle == 0) break;

    x += distance * cos(direction * M_PI/180.0);
    y += distance * sin(direction * M_PI/180.0);
    direction -= angle;
  }
  cout << (int)x << endl;
  cout << (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 << (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,theta=90.0;
	int a,b;

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

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

	}

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

	return 0;
}

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

int main(){
	double x,y,dx,dy,pi;
	int d,rad,prad;
	char camma;
	x=y=0;
	pi=3.141592;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos((rad+prad)*pi/180);
		dy=d*sin((rad+prad)*pi/180);
		x+=dx;
		y+=dy;
		prad=rad;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	return 0;
}

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

#define PI 3.1415926535

typedef struct{
  double x;
  double y;
}grid_chart;

int main()
{
  grid_chart t;
  t.x = t.y = 0;
  double angle = 0;
  while(1){
    double n, a;
    scanf("%lf,%lf", &n, &a);
    if(n == 0 && a == 0)
      break;
    else{
      t.x += n * sin(PI * angle / 180);
      t.y += n * cos(PI * angle / 180);
    }
    angle += a;
  }
  printf("%d\n%d\n", int(t.x), int(t.y));
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<cmath>

#define add push_back
#define inf 2147000000
#define pi 3.1415926535

#define rep(i,n) for(int i=0;i<n;i++)
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	double x,y,kk=pi/2;
	string str;
	char* bin;
	x=0;y=0;
	while(1){
		cin>>str;
		int t = str.find(',');
		string st1 = str.substr(0,t);
		string st2 = str.substr(t+1);
		
		double a1,a2;
		bin = &st1[0];
		a1=atoi(bin);
		bin = &st2[0];
		a2=atoi(bin);
		
		if(a1==0 && a2==0){
			break;
		}
		x+=cos(kk)*a1;
		y+=sin(kk)*a1;
		
		kk-=(double)a2/180*pi;
	}
	printf("%.0lf\n%.0lf\n",x,y);
}

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

int main(){
    double x=0,y=0;
    int degree = 90;
    double t;
    int d;
    char c;
    double pi = 3.141592;
    while(true){
       cin >> t;
       x += t*cos(degree*pi/180);
       y += t*sin(degree*pi/180);
      	cin >> c;
       cin >> d;

       degree += d;
       if(t==0&&d==0)
		break;
       
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    x = 0,y = 0;
    
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n, t, a = 90;
	char c;
	double x = 0.0, y = 0.0;
	while (cin >> n >> c >> t, n || t)
	{
		x += n * cos((double)a*3.14159265/180);
		y += n * sin((double)a*3.14159265/180);
		a -= t;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    double x = 0;
    double y = 0;
    int dir = 90;
    double PI = acos(-1.0);

    for(;;){
        int m, r;
        char c;
        cin >> m >> c >> r;
        if(m == 0)
            break;

        x += m * cos(dir * PI / 180);
        y += m * sin(dir * PI / 180);
        dir -= r;
    }

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

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

int main()
{
	double x = 0, y = 0;
	std::int16_t theta = 90;
	double const pi = std::acos(-1.0);
	std::int16_t d, t;
	char comma;

	for (std::cin >> d >> comma >> t; d != 0 || t != 0; std::cin >> d >> comma >> t) {
		x += d * std::cos(pi * theta / 180);
		y += d * std::sin(pi * theta / 180);
		theta -= t;
		if (theta < 0) {
			theta += 360;
		}
		else {
			theta %= 360;
		}
	}
	std::cout << static_cast<std::int32_t>(x) << '\n'
			  << static_cast<std::int32_t>(y) << std::endl;

	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <ctime>
#include <climits>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
#include <unordered_map>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    double x = 0, y = 0;
    double deg = 90;
    const double PI = atan(1.0) * 4.0;

    int a, b;
    char c;
    while (cin >> a >> c >> b && (a || b)) {
        x += a * cos(deg * PI / 180.0);
        y += a * sin(deg * PI / 180.0);
        deg = deg - b;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;

    return 0;
}

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

int main()
{
	int a, b;
	char c;
	double rad = M_PI / 2.0, x = 0, y = 0;
	for (cin >> a >> c >> b; a || b; cin >> a >> c >> b) {
		x += a*cos(rad);
		y += a*sin(rad);
		rad -= (b / 180.0 * M_PI);
	}
	cout << int(x) << endl << int(y) << endl;
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
double a, b; int c, d; char f;
int main() {
	while (cin >> c >> f >> d) {
		a += 1.0*sin(d) * c;
		b += 1.0*cos(d) * c;
	}
	cout << (int)a << endl << (int)b << endl;
}

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;

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),int(pos.Y-0.5));
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#define P 3.141592653589793
using namespace std;

double Y(int z){
	if(z==0||z==180)return 0.0;
	if(z<180)return sin(P/180*z);
	return -sin(P/180*(360-z));
}
double X(int z){
	if(z==90||z==270)return 0.0;
	if(z<180)return cos(P/180*z);
	return cos(P/180*(360-z));
}
int main(){
	double x=0,y=0;
	int z=90,a,b;char u;
	while(cin>>a>>u>>b&&a+b){
		y+=a*Y(z),x+=a*X(z);
		z-=b;z%=360;if(z<0)z+=360;
	}
	int xx=x,yy=y;
	cout<<xx<<endl;
	cout<<yy<<endl;
	return 0;
}