Go: package main

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

func main() {
	var a, b float64
	var x, y float64
	x = 0
	y = 0
	var now float64
	now = 90
	var info string
	for {
		fmt.Scan(&info)
		infos := strings.Split(info, ",")
		a_int, _ := strconv.Atoi(infos[0])
		b_int, _ := strconv.Atoi(infos[1])
		a = float64(a_int)
		b = float64(b_int)
		// println(a, b)
		if a == 0 && b == 0 {
			break
		}
		x += math.Cos(now*math.Pi/180)*a
		y += math.Sin(now*math.Pi/180)*a
		now -= b
	}
	fmt.Printf("%d\n%d\n", int(x), 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;
}

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

long double abs(long double x)
{
  return (x < 0.0 ? -x : x);
}

long double sqrt(long double x)
{
  const long double EPS = 1e-8;
  long double x0 = x / 2.0, nx = 0.0;

  while (abs(nx - x0) > EPS){
    nx = x0;
    x0 = (x0 + x / x0) / 2.0;
  }

  return x0;
}

long double pi(int n = 1024)
{
  long double a = 1.0, b = 1.0 / sqrt(2.0), t = 1.0 / 4.0, p = 1;

  for (int i = 1; i < n; i++){
    long double na, nb, nt, np;
    na = (a + b) / 2.0;
    nb = sqrt(a * b);
    nt = t - p * (a - na) * (a - na);
    np = 2.0 * p;

    a = na;
    b = nb;
    t = nt;
    p = np;
  }

  return (a + b) * (a + b) / (4.0 * t);
}

long double fact(int n)
{
  long double ret = 1.0;
  for (int i = 1; i <= n; i++)
    ret *= (long double)i;
  return ret;
}

long double pow(long double x, int n)
{
  if (n == 0) return 1.0;
  long double a = pow(x, n / 2);
  if (n & 1){
    return a * a * x;
  } else {
    return a * a;
  }
}

long double sin(int x, int n = 1000)
{
  long double m_pi = pi();
  long double r = ((long double)x * m_pi) / 180.0;

  long double ret = 0.0;
  for (int i = 0; i < n; i++){
    long double p = pow(r, 2 * i + 1);
    long double f = fact(2 * i + 1);

    ret += ((long double)pow(r, 2 * i + 1) / (long double)fact(2 * i + 1)) * (i & 1 ? -1.0 : 1.0);
  }

  return ret;
}

long double cos(int x, int n = 1000)
{
  long double m_pi = pi();
  long double r = ((long double)x * m_pi) / 180.0;

  long double ret = 0.0;
  for (int i = 0; i< n; i++){
    ret += ((long double)pow(r, 2 * i) / (long double)fact(2 * i)) * (i & 1 ? -1.0 : 1.0);
  }

  return ret;
}

int main()
{
  long double x, y;
  int d, a;
  x = y = 0.0;

  int r = 90;
  while(true){
    int d, a;
    scanf("%d,%d", &d, &a);
    if (d == 0 && a == 0){
      break;
    }

    x += cos(r) * (double)d;
    y += sin(r) * (double)d;

    r -= a;
  }

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