Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func main() {
	scanner.Split(bufio.ScanWords)

	x, y := 0.0, 0.0
	rotate := 90.0

	for {
		line := nextString()
		if line == "0,0" {
			break
		}

		numbers := strings.Split(line, ",")
		di, _ := strconv.ParseFloat(numbers[0], 64)
		ai, _ := strconv.ParseFloat(numbers[1], 64)

		rotateRadian := math.Pi * rotate / 180.0
		x += di * math.Cos(rotateRadian)
		y += di * math.Sin(rotateRadian)

		rotate -= ai

		// fmt.Println(x, y)
	}

	fmt.Println(int(x))
	fmt.Println(int(y))
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

int main(int argc, char const *argv[])
{
	int d, a;
	int deg = 90.;
	double x = 0., y = 0.;
	while(1)
	{
		if (scanf("%d,%d", &d, &a) == EOF) break;
		if (d == 0 && a == 0) break;
		double rad = (double)deg / 180. * M_PI;
		x += d * cos(rad);
		y += d * sin(rad);
		deg -= a;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

#define PI 3.141592

using namespace std;

int main(){
	string stepsandrad;
	double steps, dir,rad=0.0;
	double y=0.0,x=0.0;

	while (true){

		cin >> stepsandrad;

		sscanf(stepsandrad.c_str(), "%lf,%lf", &steps, &dir);

		if (steps == 0 && dir == 0)
			break;

		y += steps*cos(rad);
		x += steps*sin(rad);

		rad += dir * PI / 180.0;

	}

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

	return 0;
}

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

using namespace std;

int main() {
    int a=1;
    int b=1;
    
    double degree=90.0;
    
    double x=0.0;
    double y=0.0;

    while (a!=0&&b!=0){
        scanf("%d,%d",&a,&b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<" "<<(int)y;
    
    return 0;
}

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;
}