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<math.h>
using namespace std;
#define m an/180.0*M_PI
int main(){
    double x=0,y=0,a,b,an=90;
    char c;
    while(cin>>a>>c>>b,a,b){
        x+=a*cos(m);
        y+=a*sin(m);
        an-=b;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}

C++: #include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


double deg2rad(int deg){
	return M_PI * deg / 180;
}

int main(int argc, char **argv){
	int d = 0;
	int a = 0;
	char tmp = 0;
	double x = 0;
	double y = 0;
	int theta = 90;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

	for(;;){
#if INPUT_FROM_FILE
		ifs >> d >> tmp >> a;
#else
		std::cin >> d >> tmp >> a;
#endif
		if(d == 0 && a == 0) { break; }

		x += d * cos(deg2rad(theta));
		y += d * sin(deg2rad(theta));

		theta -= a;
	}
	std::cout << int(x) << std::endl;
	std::cout << int(y) << std::endl;
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	double x = 0.0, y = 0.0;
	int d, a;
	int ca = 90;
	char c;
	cin >> d >> c >> a;

	do {
		x += d * cos(ca / 180.0 * PI);
		y += d * sin(ca / 180.0 * PI);
		ca -= a;
		cin >> d >> c >> a;

	} while (d != 0 || a != 0);
	cout << fixed << setprecision(0) << x << endl << y << endl;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double x=0,y=0,d,a,b=90;
  for(;;){
    scanf("%lf,%lf",&d,&a);
    if(d == 0 && a == 0) break;
    x+=d*cos(M_PI*b/180);
    y+=d*sin(M_PI*b/180);
    b-=a;
  }
  cout <<(int)x<<endl<<(int)y<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

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

int main(void) {

  int d,t;
  int x=0,y=0;
  int ang=90;

  while(1) {

    scanf("%d,%d",&d,&t);

    if(d==0 && t==0) break;
    
    x+=d*cos(ang*M_PI/180);
    y+=d*sin(ang*M_PI/180);

    ang-=t;
  }

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

  return 0;
}

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

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

#define M_PI 3.14159265358979323846

float dtor(int d){
	return d / 180.0 * M_PI;
}

int main(void){
	float x = 0.0, y = 0.0;
	int d = 0,a = 0, an = 90;

	while(true){
		scanf("%d,%d", &d, &a);
		printf("%d,%d\n", d, a);
		if(d == 0 && a == 0){ break; }
		x += d * cosf(dtor(an));
		y += d * sinf(dtor(an));
		an -= a;
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;

int main(){

	double a,b; double c=90; double x=0; double y=0;
	while(true){
	scanf("%d %d",&a,&b);
	if(a==0 && b==0) break;
	x+=a*cos(c*3.141592/180);
	y+=a*sin(c*3.141592/180);
	c-=b;

	}

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

	return 0;

    }

C++: #include <stdio.h>
#include <math.h>
#define PI 3.141592653589
int main() {double corn=0.00,x=0.00,y=0.00;int i,j;while (1) {scanf("%d,%d",&i,&j);if (!i && !j) break;x+=i*sin(corn);y+=i*cos(corn);corn+=(j*PI)/180.00;}printf("%d\n%d\n",(int)(x),(int)(y));return 0;}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	int m, n;
	double x = 0, y = 0;
	double rad = PI/2;
	char in[10];
	const char *delim = ",";

	while(cin >> in){
		m = atoi(strtok(in, delim));
		n = atoi(strtok(NULL, delim));
		if( m == 0 && n == 0){
			break;
		}
		x += m * cos(rad);
		y += m * sin(rad);
		rad -= PI/180 * n;
	}

	cout << (int)x << "\n" << (int)y << endl;

	return 0;
}

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

int main()
{
    double x = 0;
    double y = 0;
    double a = M_PI_2;
    while(true){
        int d, t;
        char c;
        std::cin >> d >> c >> t;
        if(d == 0 && t == 0) break;
        x += d * std::cos(a);
        y += d * std::sin(a);
        a += (-t * M_PI / 180);
    }
    double IntX, IntY;
    std::modf(x, &IntX);
    std::modf(y, &IntY);
    std::cout << std::fixed << std::setprecision(0);
    std::cout << IntX << std::endl;
    std::cout << IntY << std::endl;
    return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double d = 0.0;	// ????????????????????¢
	double a = 0.0;	// ?????????????????????
	double x = 0.0;
	double y = 0.0;
	int ak = 90;	// ???????????????90????????????
	while (true)
	{
		scanf("%lf,%lf", &d, &a);	// double?????????????????????%f??§????????????%lf?????????
		cout << d << a << endl;
		if (d == 0 && a == 0) { cout << "???????????????" << endl;	break; }
		x += cos(ak*M_PI / 180) * d;
		y += sin(ak*M_PI / 180) * d;
		ak -= a;
		ak %= 360;
	}
	// ??????
	cout << (int)x << "\n" << (int)y << endl;
	return 0;
}