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 <string>
#include <sstream>
#define _USE_MATH_DEFINES
#include <cmath>
int main()
{
  std::string line;
  double x = 0.0, y = 0.0;
  int dir_deg = 90;
  while (std::cin >> line) {
    int i = line.find(",");
    if (i != -1) line.replace(i, 1, " ");

    std::istringstream iss(line);
    int d, t;
    iss >> d >> t;
    if (d == 0 && t == 0) break;

    double rad = dir_deg * M_PI / 180.0;
    x += std::cos(rad) * d;
    y += std::sin(rad) * d;
    dir_deg -= t;
    if (dir_deg <= -180) dir_deg += 360;
    if (dir_deg >=  180) dir_deg -= 360;
  }
  std::cout << static_cast<int>(x) << std::endl << static_cast<int>(y) << std::endl;
  return 0;
}

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

using namespace std;

void solve()
{
	int d, t;
	double x = 0, y = 0;
	double angle = 90;
	while(true)
	{
		scanf("%d,%d", &d, &t);
		if(d == 0 && t == 0)
		{
			break;
		}
		x += d * cos(angle / 180 * M_PI);
		y += d * sin(angle / 180 * M_PI);
		angle -= t;
	}
	cout << (int)x << endl;	
	cout << (int)y << endl;
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
using namespace std;
#define PI 3.141592
int main(){
  float angle=0;
  float x=0,y=0;
  float d,t;
  string str;
  cin >> str;
  if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else if(str.size()==5) t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      else t = ((str[3]-'0')*100+(str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else if(str.size()==4) t = (str[2]-'0')*10+(str[3]-'0');
      else t = (str[2]-'0')*100+(str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else if(str.size()==6) t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
      else t = ((str[4]-'0')*100+(str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else if(str.size()==5) t = (str[3]-'0')*10+(str[4]-'0');
      else t = (str[3]-'0')*100+(str[4]-'0')*10+(str[5]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else if(str.size()==7) t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      else t = ((str[5]-'0')*100+(str[6]-'0')*10+(str[7]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else if(str.size()==6) t = (str[4]-'0')*10+(str[5]-'0');
      else t = (str[4]-'0')*100+(str[5]-'0')*10+(str[6]-'0');
    }
  }
  while(d!=0||t!=0){
    x+=d*sin(angle/180*PI);y+=d*cos(angle/180*PI);
    angle+=t;
    if(angle>360) angle-=360;
    if(angle<-360) angle+=360;
    cin >> str;
      if(str[1]==','){
    d= str[0]-'0';
    if(str[2]=='-'){
      if(str.size()==4) t = (str[3]-'0')*(-1);
      else if(str.size()==5) t = ((str[3]-'0')*10+(str[4]-'0'))*(-1);
      else t = ((str[3]-'0')*100+(str[4]-'0')*10+(str[5]-'0'))*(-1);
    }else{
      if(str.size()==3) t = str[2]-'0';
      else if(str.size()==4) t = (str[2]-'0')*10+(str[3]-'0');
      else t = (str[2]-'0')*100+(str[3]-'0')*10+(str[4]-'0');
    }
  }else if(str[2]==','){
    d= (str[0]-'0')*10+str[1]-'0';
    if(str[3]=='-'){
      if(str.size()==5) t = (str[4]-'0')*(-1);
      else if(str.size()==6) t = ((str[4]-'0')*10+(str[5]-'0'))*(-1);
      else t = ((str[4]-'0')*100+(str[5]-'0')*10+(str[6]-'0'))*(-1);
    }else{
      if(str.size()==4) t = str[3]-'0';
      else if(str.size()==5) t = (str[3]-'0')*10+(str[4]-'0');
      else t = (str[3]-'0')*100+(str[4]-'0')*10+(str[5]-'0');
    }
  }else if(str[3]==','){
    d= (str[0]-'0')*100+(str[1]-'0')*10+(str[2]-'0');
    if(str[4]=='-'){
      if(str.size()==6) t = (str[5]-'0')*(-1);
      else if(str.size()==7) t = ((str[5]-'0')*10+(str[6]-'0'))*(-1);
      else t = ((str[5]-'0')*100+(str[6]-'0')*10+(str[7]-'0'))*(-1);
    }else{
      if(str.size()==5) t = str[4]-'0';
      else if(str.size()==6) t = (str[4]-'0')*10+(str[5]-'0');
      else t = (str[4]-'0')*100+(str[5]-'0')*10+(str[6]-'0');
    }
  }
  }
  int x1=x,y1=y;
  
  printf("%d\n%d\n",x1,y1);
  return 0;
}

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

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

C++: #include <algorithm>
#include <cmath>
#include <ctime>
#include <climits>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
#include <unordered_map>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    double x = 0, y = 0;
    double deg = 90;
    const double PI = atan(1.0) * 4.0;

    int a, b;
    char c;
    while (cin >> a >> c >> b && (a || b)) {
        x += a * cos(deg * PI / 180.0);
        y += a * sin(deg * PI / 180.0);
        deg = deg - b;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;

    return 0;
}