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 <iostream>
#include <cmath>
using namespace std;

#define PI 3.1415926535897932386

int main()
{
	int x, r;
	double X = 0, Y = 0, rad = 90;

	while(1){
		//üÍ
		cin>>x;
		cin>>r;

		//0¾Á½çIíé
		if(x == 0 && r == 0){
			break;
		}

		X += x * cos(rad * PI/180);
		Y += x * sin(rad * PI/180);

		rad -= r;
	}
	
	X = (int)X;
	Y = (int)Y;

	cout<<X<<endl<<Y;

	cin.sync();
	cin.get();
}

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

int main(){

  int r, deg, theta;
  double x, y, rad;

  x = 0.0;
  y = 0.0;
  theta = 0;
  rad = M_PI / 180;
  do{
    scanf("%d, %d", &r, &deg);
    if(r == 0 && deg == 0) break;
  	x += r * cos(theta * rad);
  	y += r * sin(theta * rad);
    theta = theta + deg;
  }while(1);

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

  return 0;
}

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

struct TCoordinate
{
	double X;
	double Y;
};

struct TPolarCoordinate
{
	int Distance;
	int Degree;
};

TCoordinate Move(TPolarCoordinate PolarCoordinate, TCoordinate CurrentCoordinate)
{
	CurrentCoordinate.Y += PolarCoordinate.Distance * cos(PolarCoordinate.Degree * M_PI / 180);
	CurrentCoordinate.X += PolarCoordinate.Distance * sin(PolarCoordinate.Degree * M_PI / 180);
	return CurrentCoordinate;
}

int main()
{
	TCoordinate CurrentCoordinate = {0, 0};
	int BeforeInputDegree = 0;
	while(true){
		TPolarCoordinate Input;
		char Dummy;
		cin >> Input.Distance >> Dummy >> Input.Degree;
		if(Input.Distance == 0 && Input.Degree == 0) break;
		CurrentCoordinate = Move({Input.Distance, BeforeInputDegree}, CurrentCoordinate);
		BeforeInputDegree += Input.Degree;
	}
	double GaussX, FractionalX, GaussY, FractionalY;
	FractionalX = modf(CurrentCoordinate.X, &GaussX);
	FractionalY = modf(CurrentCoordinate.Y, &GaussY);
	cout << fixed << setprecision(0) << GaussX << endl << GaussY << endl;
	return 0;
}

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

int main(void){

    double x=0,y=0;
    int a,b;
    int q=90;
    char z;
    for(;;){
    scanf("%d%c%d",&a,&z,&b);
        if(a==0&&b==0)break;
        y += a*sin(((double)q/180)*3.141592);
        x += a*cos(((double)q/180)*3.141592);
        q -= b;
    }
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    return 0;
}

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

#define PI 3.14

int main()
{
	int x=1,y=1;
	double r=90,k=0,h=0;
	for(;x!=0||y!=0;)
	{
		scanf("%d,%d",&x,&y);
		k+=x*sin(r*PI/180);
		h+=x*cos(r*PI/180);
		r-=y;

		if(r>270)
		{
			r-=360;
		}
		else if(r<-270)
		{
			r+=360;
		}
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

int main(){
	const double PI=3.14159265358979;
	int x,y;
	double theta=0;
	double sum_x=0;
	double sum_y=0;
	char c;
	
	while(std::cin >> x >> c >> y){
		sum_y += x * cos(theta * PI / 180);
		sum_x += x * sin(theta * PI / 180);
		theta += y;
	}
	
	std::cout << (int)sum_x << std::endl;
	std::cout << (int)sum_y << std::endl;

}

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+=1;
  if(y<0) y+=1;
  printf("%.0f\n%.0f\n",floor(x),floor(y));
  return 0;
}

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

const double pi = acos(-1.0);

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

C++: #define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>


int main()
{
double N,P=0;
double x,y;
double p=0,P1=0;
x=0;y=0;
while(1)
{
scanf("%lf,%lf",&N,&P1);
if((int)N==0&&(int)P1==0)break;

x+=N*sin(P*M_PI/180);y+=N*cos(P*M_PI/180);

P+=P1;
}
int X,Y;
X=(int)x;Y=(int)y;
printf("%d\n",X);printf("%d\n",Y);

return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x,y,dis,ang = 90,a;
  for(;;){
    scanf("%lf,%lf",&dis,&a);
    if(dis == 0 && a == 0){break;}
    x+=dis*cos(3.1415*2*ang/360);
    y+=dis*sin(3.1415*2*ang/360);
    ang-=a;
  }
  printf("%.0lf\n%.0lf\n",x,y);
  return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int main(){
	double x=0, y=0, r=90;//初期設定
	double d, rd;//入力値　更新部分
	char c;//ごみ
	
	while(cin>> d >> c >> rd){
		if(d==0 && rd==0) break;

		x+=d*cos(r/180*M_PI);
		y+=d*sin(r/180*M_PI);
		r-=rd;
	}

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

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class t>
using table = vector<vector<t>>;
const ld eps=1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.answer"
int main() {
	complex<ld>way(0,1);
	complex<ld>now(0, 0);
	while (1) {
		int a, b;
		scanf("%d,%d", &a, &b);
		if (!a&&!b)break;
		now += way*ld(a);
		ld theta = -ld(b) / 180 * acos(-1);
		way *=complex<ld>(cos(theta),sin(theta));

	}
	cout << int(now.real()) << endl << int(now.imag()) << endl;
	return 0;
}

C++: #include <iostream>

#define M_PI 3.141592653589793

using namespace std;

int debug = 0;

int main(void){
	int len, deg, direction=90;
	double x=0, y=0;
	int i_x, i_y;

	while(cin >> len){
		cin.ignore(); //read ,
		cin >> deg;

		if(len == 0 && deg == 0) break;

		//proceed
		x += len * cos(direction * M_PI / 180);
		y += len * sin(direction * M_PI / 180);
		
		//turn clockwise
		direction -= deg;

	}

	i_x = x;
	i_y = y;

	cout << i_x << endl;
	cout << i_y << endl;

	return 0;
}

C++: #include <iostream> 
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
int main(){
	int x,m,r=90;
	double ansX=0,ansY=0;
	char com;
	while(1){
		cin>>m>>com>>x;
		if(m==0&&x==0)break;
		ansX+=m*cos(3.1415*r/180);
		ansY+=m*sin(3.1415*r/180);
		r-=x;
	}
	cout<<(int)ansX<<" "<<(int)ansY<<endl;
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define pi 3.14159265358979

int main(){
	double teku[10000]={0.0},sita=pi/2,set_sita[10000]={0.0},x=0.0,y=0.0;
	int i=0,j=0;
	
	while(scanf("%lf,%lf",&teku[i],&set_sita[i])!=EOF){
		if(teku[i]==0 && set_sita[i]==0)break;
		
		set_sita[i]=set_sita[i]/180.0 * pi;
		
		for(j=0;j<teku[i];j++){
			x+=cos(sita);
			y+=sin(sita);
		}
		sita+=set_sita[i];
		i++;
	}

		printf("%.0f\n%.0f\n",floor(x),floor(y));
	return 0;
}