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 <vector>
#include <cmath>
using namespace std;
int main()
{
    vector<int> a, b;
    string u;
    b.push_back(0);
    while (true) {
        cin >> u;
        int s, t;
        sscanf(u.c_str(), "%d,%d", &s, &t);
        if (!(s | t)) break;
        a.push_back(s);
        b.push_back(t);
    }
    int n = a.size();
    int deg = 0;
    double x = 0, y = 0;
    for (int i = 0; i < n; ++i) {
        deg += b[i];
        x += a[i] * sin(M_PI * deg / 180.0);
        y += a[i] * cos(M_PI * deg / 180.0);
    }
    cout << (int)x << endl;
    cout << (int)y << 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<cstdio>
#include<cmath>
#include<iostream>
#define PI 3.14159265358979
double rad(double a){
  return a*PI/180.0;
}

int main(){
  int a,b;
  int th=0;
  double x = 0, y = 0;
  while(scanf("%d,%d",&a,&b)){
    if(a==0&&b==0)break;
    x+=(double)a*sin(rad(th));
    y+=(double)a*cos(rad(th));
    th+=b;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

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

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

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>
#include <math.h>

using namespace std;
typedef long long Int;
#define REP(i , x) for(Int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;


int main()
{
	int a, b;

	double x = 0; 
	double y = 0;
	int radius = 0;


	while (scanf("%d,%d", &a, &b), a&&b){
		y += a*sin(radius*M_PI/180);
		x += a*cos(radius*M_PI/180);
		radius += b;
	}
	y *= 10;
	int y_ = y;
	y_ %= 10;
	y_ /= 10;

	x *= 10;
	int x_ x;
	x_ %= 10;
	x_ /= 10;

	cout << (int)y_ << endl << (int)x_ << endl;                                                        
	return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>
#include<math.h>

using namespace std;

#define	PI 3.141592

int main(void)
{
  int a=1, b=1;
  double n=0.0;
  double e=0.0;
  int r=90;

  while(a!=0 || b!=0)
    {
      scanf("%d,%d", &a, &b);
      n+=a*sin(r*PI/180.0);
      e+=a*cos(r*PI/180.0);
      r-=b;
      r%=360;
    }

  cout<<(int)e<<endl<<(int)n<<endl;

}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
  double x=0;
  double y=0;
  int d;
  int a=90;
  int _a;
  char c;
  while(true){
    cin>>d>>c>>_a;
    if(d==0 && _a==0)
      break;
    x+=d*cos(a*M_PI/180);
    y+=d*sin(a*M_PI/180);
    a-=_a;
  }
  cout<<(int)x<<endl;
  cout<<(int)y<<endl;
  return 0;
}

C++: #include <stdio.h>
#include <math.h>
#define PI 3.141592653589793 

int main(){
    int a0=90;
    int di,ai1;
    double x=0,y=0;
    scanf("%d,%d",&di,&ai1);
    while(di||ai1){
        x += di*cos(a0*(PI/180));
        y += di*sin(a0*(PI/180));
        a0 -= ai1;
        scanf("%d,%d",&di,&ai1);
    }
    printf("%d\n%d\n",(int)x,(int)y);
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
#define PI 3.141592653589793

using namespace std;

int main() {
  string str;
  int to;
  double x,y,direction,r,theta;
  x = 0;
  y = 0;
  r = 0;
  theta = 0;
  direction = 90;
  while(cin >> str) {
    to = str.find(",",0);
    r = (double)strtol(str.substr(0,to).c_str(),NULL,10);
    theta = strtol(str.substr(to+1).c_str(),NULL,10);
    if( r == 0 && theta == 0) break;
    //cout << direction << endl;
    x += r * cos(direction * (PI / 180.0));
    y += r * sin(direction * (PI / 180.0));
    direction -= (double)theta;
    str = "0";
  }
  cout << x << endl << y << endl;
}

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

int main(){
	double x = 0.0;
	double y = 0.0;
	double angle = 90.0;
	int d, a;
	while(scanf("%d,%d", &d, &a)){
		if(d == 0 && a == 0){
			break;
		}
		x += (double)d*cos(angle*PI/180.0);
		y += (double)d*sin(angle*PI/180.0);
		angle -= (double)a;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

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

int main() {
	double x=0, y=0, a, b, now = 90;
	char c;
	while (cin >> a >> c >> b, a || b) {
		x += a * cos(M_PI * now / 180);
		y += a * sin(M_PI * now / 180);
		now = now - b;
	}
	if (x >= 0) x = floor(x);
	else if (x < 0) x = ceil(x);
	if (y >= 0) y = floor(y);
	else if (y < 0) y = ceil(y);
		cout << x << " " << y << endl;
}

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

int main() {
    int s, d;
    char c;
    double px = 0.0, py = 0.0;
    double dir = 90.0;

    while(cin >> s >> c >> d) {
        if(s == 0 && d == 0) break;
        px += cos(dir * M_PI / 180.0) * s;
        py += sin(dir * M_PI / 180.0) * s;
        dir -= d;
    }
    cout << static_cast<int>(px) << endl;
    cout << static_cast<int>(py) << endl;
    return 0;
}

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

#define PI 3.14159265

using namespace std;

int main(){
  int theta,x;
  double x_sum,y_sum,theta_sum;
  
  y_sum =0;
  scanf("%d,%d",&x,&theta);
  x_sum = x,theta_sum = theta;
  while(1){
    scanf("%d,%d",&x,&theta);
    if(x == 0 && theta == 0) break;
    x_sum += x*sin(theta_sum * PI / 180);
    y_sum += x*cos(theta_sum * PI / 180);
    theta_sum += theta;
  }

  cout << floor(x_sum) << endl << floor(y_sum) << endl;

  return 0;

}

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

int main() {
	double x = 0, y = 0, rad = 90 * M_PI / 180;
	int a, b;
	while (scanf("%d,%d", &a, &b) && (a || b)) {
		x += a*cos(rad);
		y += a*sin(rad);
		//????????????
		rad -= b*M_PI / 180;
	}
	cout << (int)x << endl << (int)y << endl;
	return 0;
}