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 <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define PI 3.141592

int d, t;
double x, y, deg;

int main() {
	x = 0;
	y = 0;
	deg = 90;

	scanf("%d,%d", &d, &t);
	while (!(d == 0 && t == 0)) {
		x += d * sin((double)deg / 180 * PI);
		y += d * cos((double)deg / 180 * PI);
		deg -= t;
		scanf("%d,%d", &d, &t);
	}
	cout << (int)y << endl;
	cout << (int)x << endl;

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

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

void walk(double current_point[2], int r, int sum_theta) {
	double pi = 3.14159265358979; 
	double rad = ((double)sum_theta / 180) * pi;
	current_point[0] += r * sin(rad);
	current_point[1] += r * cos(rad);
}

int main() {
	int r;
	int theta;
	int sum_theta = 0;
	double current_point[2] = {0, 0};

	do {
		scanf("%d,%d", &r, &theta);

		walk(current_point, r, sum_theta);
		sum_theta += theta;
	} while(r || theta);

	printf("%.0lf\n", current_point[0]);
	printf("%.0lf\n", current_point[1]);

	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 <bits/stdc++.h>
using namespace std;

const double pi = acos(-1);

int main() {
  int len, ang;
  double ax = 0, ay = 0;
  double vis = 90;

  while(scanf("%d,%d", &len, &ang)) {
    if(len+ang == 0) break;

    ax += len * cos(pi*vis/180);
    ay += len * sin(pi*vis/180);
    vis -= ang; 
  }

  cout << (int)ax << endl;
  cout << (int)ay << endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
using namespace std;
#define PI 3.141592
int main(){
  float angle;
  float x=0,y=0;
  float d,t;
  string str;
  cin >> str;
  if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else t = (str[2]-'0')*10+(str[3]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else t = (str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else t = (str[4]-'0')*10+(str[5]-'0');
    }
  }
  while(d!=0||t!=0){
    x+=d*sin(angle/180*PI);y+=d*cos(angle/180*PI);
    angle+=t;
    //if(angle>360) angle-=360;
    //if(angle<-360) angle+=360;
    
    
    cin >> str;
    if(str[1]==','){
      d= str[0]-'0';
      if(str[2]=='-'){
	if(str.size()==4) t = (str[3]-'0')*(-1);
	else t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      }else{
	if(str.size()==3) t = str[2]-'0';
	else t = (str[2]-'0')*10+(str[3]-'0');
      }
    }else if(str[2]==','){
      d= (str[0]-'0')*10+str[1]-'0';
      if(str[3]=='-'){
	if(str.size()==5) t = (str[4]-'0')*(-1);
	else t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
	if(str.size()==4) t = str[3]-'0';
	else t = (str[3]-'0')*10+(str[4]-'0');
      }
    }else if(str[3]==','){
      d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
      if(str[4]=='-'){
	if(str.size()==6) t = (str[5]-'0')*(-1);
	else t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      }else{
	if(str.size()==5) t = str[4]-'0';
	else t = (str[4]-'0')*10+(str[5]-'0');
      }
    }
  }
  int x1=x,y1=y;
  printf("%d\n%d\n",x1,y1);
  return 0;
}

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

#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif

int main(int argc, char** argv)
{
  double dx = 0.0, dy = 1.0;

  double x = 0, y = 0;

  int d, t;

  for (int i = 0; fscanf(stdin, "%d,%d", &d, &t) == 2; i = (i + 1) % 4) {
    if (d == 0 && t == 0)
      break;

    x += d * dx;
    y += d * dy;
    
    double r = t / 180.0 * M_PI;

    double ndx =  cos(r) * dx + sin(r) * dy;
    double ndy = -sin(r) * dx + cos(r) * dy;

    dx = ndx;
    dy = ndy;
  }
  fprintf(stdout, "%d\n%d\n", int(x), int(y));
}

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

double cx,cy;
int cangle;
typedef pair<int,int> P;
queue<P> move;

int main()
{
    int dis,ang;
    while(true){
        scanf("%d%*c%d",&dis,&ang);
        if(dis==0 && ang==0)break;
        move.push(P(dis,ang));
    }
    cx = 0.0; cy = 0.0;
    cangle = 90;
    while(!move.empty()){
        P p = move.front();move.pop();
        cx += (double)p.first*cos(cangle*M_PI/180);
        cy += (double)p.first*sin(cangle*M_PI/180);
        cangle -= p.second;
    }

    cout << (int)cx << endl;
    cout << (int)cy << endl;

    return 0;
}

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

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

int main(void){
	double x=0.0, y=0.0;
	double rad=M_PI/2.0;
	int r,a; char c;
	
	while(cin>>r>>c>>a){
		if( r==0 && a==0 ) break;
		double dx = r*cos(rad);
		double dy = r*sin(rad);
		rad -= a*M_PI/180.0;
		x+=dx; y+=dy;
	}

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

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

int main(){
  int a,pre_d=90,d;
  double x=0,y=0;

  while(1){
    scanf(" %d,%d",&a,&d);
    if(a==0&&d==0) break;
    //std::cout << (double)a << (double)d <<std::endl;
    x += (double)a*cos((double)pre_d*M_PI/180);
    y += (double)a*sin((double)pre_d*M_PI/180);
    pre_d += -d;
  }
  //std::cout << (double)a << std::endl;
  x -= 0.5;
  y -= 0.5;
  printf("%.0f\n%.0f\n",x,y);

}