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<cstdio>
#include<cmath>

int main(){
	double x = 0, y = 0;
	double a,b,d = 90;
	scanf("%lf,%lf", &a, &b);
	while(a || b){
		y += a * sin(d * M_PI / 180);
		x += a * cos(d * M_PI / 180);
		d -= b;
		scanf("%lf,%lf", &a, &b);
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

int main(){
	int d, r;
	double x = 0, y = 0, nr = 0;
	while( scanf("%d,%d", &d, &r), d || r ){
		double rad = nr/180*M_PI;
		x += (cos(rad)*d);
		y += (sin(rad)*d);
		nr += r;
	}
	cout << (int)y << endl;
	cout << (int)x << endl;
}

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

const double PI = 3.1415926535;

int main(){
	int n, th;
	double x = 0;
	double y = 0;
	int nth = 90;
	while(scanf("%d,%d", &n, &th)){
		if(!n&&!th) break;
		x += n*cos(PI*nth/180);
		y += n*sin(PI*nth/180);
		nth -= th;
		nth %= 360;
	}
	printf("%d\n", x > 0 ? int(x) : -1*int(-1*x));
	printf("%d\n", y > 0 ? int(y) : -1*int(-1*y));
	return 0;
}

C++: #include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <math.h>
#define PI 3.141592
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  double x,y,ca,a,l;
  x = 0; y = 0; ca = PI / 2;
  char c;
  while (true) {
    cin >> l >> c >> a; // 進む距離と回転角度
    if (l == 0 && a == 0) break;

    x += l * cos(ca);
    y += l * sin(ca);

    ca -= a * PI / 180.0;
  }

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

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

int main()
{
	double PI = 4 * atan(1);
	int l, t1, t2 = 0, c = 0;
	double x = 0, y = 0;
	while(scanf("%d,%d", &l, &t1) && (l != 0 || t1 != 0)){
		x += (double)l * sin(PI * (double)t2 / 180);
		y += (double)l * cos(PI * (double)t2 /180);
		t2 += t1;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int d, a, pa = 0;
    double x = 0, y = 0;
    while (true){
        scanf("%d,%d", &d, &a);
        if (d == 0 && a == 0) break;
        x += d * sin(pa*M_PI/180);
        y += d * cos(pa*M_PI/180);
        pa += a;
    }
    int ax = x, ay = y;
    printf("%d\n%d\n", ax, ay);
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle;
while(cin>>step>>",">>turn,step,turn){
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(void){
    ios::sync_with_stdio(false);
    char a;
    double x=0,y=0,num,deg1,deg=90;
    while(cin>>num>>a>>deg1,num||deg1){
        x+=(cos(deg*M_PI/180)*num);
        y+=(sin(deg*M_PI/180)*num);
                deg-=deg1;
    }
    cout << (int)x << "\n" << (int)y << "\n";
    return 0;
}

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

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=90;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos(prad*pi/180);
		dy=d*sin(prad*pi/180);
		x+=dx;
		y+=dy;
		prad=prad+rad;
		//cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	//while(1);
	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;
	int a,b,theta=0;

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

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

	}

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

	return 0;
}

C++: #include<cstdio>
#include<cmath>
constexpr double pi(){return std::atan(1)*4;}
double degToRad(double deg){
  return deg * pi() / 180;
}
int main(){
  double x=0,y=0,angle=0;
  for(;;){
    int leng,rot;
    scanf("%d,%d",&leng,&rot);
    if(!(leng|rot)){break;}
    y+=cos(degToRad(angle))*leng;
    x+=sin(degToRad(angle))*leng;
    angle+=rot;
  }
  printf("%d\n%d\n",(int)x,(int)y);
}

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

const double rad = 3.141592 / 180;

int main(){
	double x, y;
	int r, angle, nangle;
	x = y = r = angle = nangle = 0;
	while(true){
		scanf("%d,%d", &r, &angle);	
		if(r == 0 && angle == 0)
			break;
		x += sin(rad * nangle) * r;
		y += cos(rad * nangle) * r;
		nangle += angle;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		scanf("%d,%d", &len, &deg);
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180.0 * M_PI);
		y += len*sin(deg_now / 180.0 * M_PI);
		deg_now += deg;
	}

	cout << x << endl << y << endl;

	return 0;

}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <vector>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)
#define PI 3.1415926535897932384626433
#define ToRadian(r) ((r)/180.0*PI)
#define ToDegree(r) ((r)*180.0/PI)

using namespace std;

int main( void )
{
	int dist, deg;
	double ax, ay, rad;
	
	ax = ay = 0;
	rad = ToRadian(90);
	
	while (scanf("%d,%d", &dist, &deg), dist | deg)
	{
		ax += dist * cos(rad);
		ay += dist * sin(rad);
		rad += ToRadian(-deg);
	}
	
	printf("%d\n" \
		   "%d\n", (int)ax, (int)ay
	);
	
	return 0;
}

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

int main(void) {
    double x = 0, y = 0, c = 0;
    int a, b;
    while (true) {
        scanf("%d,%d", &a, &b);
        if (a == 0 && b == 0) break;
        x += a * sin(c);
        y += a * cos(c);
        c += (b / 180.0) * M_PI;
    }
    printf("%d\n%d\n", (int)x, (int)y);
    return 0;
}

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

using namespace std;

int main(){
	double sumX = 0;
	double sumY = 0;
	double d,rad = 3.1415/2;
	double theta;
	while(1){

		cin >> d ;
		getchar();
		cin >> theta;
		if(d == 0 and theta == 0) break;
		sumX += d * cos(rad);
		sumY += d * sin(rad);
		rad -= (3.1415*theta)/180.0;
	}

	cout << (int)sumX << " " << (int)sumY << endl;
	return 0;
}

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

int main() {
	double x=0, y=0;
	double a, b;
	double c=90;
	while (scanf("%lf,%lf", &a, &b)&&a!=0&&b!=0) {
		x += cos(c*3.14159265/180)*a;
		y += sin(c*3.14159265/180)*a;

		c =90- b;
	}
	x = floor(x);
	y = floor(y);
	cout << x << y << endl;

	return 0;
}