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 <cmath>

using namespace std;
#define PI 3.141592

int main()
{
	int value,value_2;
	char c;
	double x=0.0,y=0.0,angle = 90;

	while(cin >> value >> c >> value_2)
	{
		if(value == 0 && value_2 == 0) break;

		x += cos(angle*PI/180)*value;
		y += sin(angle*PI/180)*value;
		angle -= value_2;
	}
	cout << (int)x << endl << (int)y << endl;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
    double x,y,a,c,rad;
    a=c=0;
    rad=M_PI/2;
    while(scanf("%lf,%lf",&x,&y),x||y){
        a+=x*sin(rad);
        c+=x*cos(rad);
        rad-=y/180*M_PI;
    }
    cout<<(int)c<<endl<<(int)a<<endl;
    return 0;
}

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

#define PI 3.141592

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;
	}
	printf("%.0f\n%.0f\n",h,k);
}

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

#define PI 3.141592654

int main() {
	double coor[3] = { 0,0,90 };
	int length, angle;
	while (1) {
		scanf("%d,%d", &length, &angle);
		if (length == 0 && angle == 0)break;
		coor[0] += (double)length * cos((double)coor[2] * PI / 180);
		coor[1] += (double)length * sin((double)coor[2] * PI / 180);
		coor[2] -= angle;
		printf("test %d %d %d\n", (int)coor[0], (int)coor[1],(int)coor[2]);
	}
	printf("%d\n%d\n", (int)coor[0], (int)coor[1]);
	return 0;
}

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

#define PI 3.14159265359

int main()
{
    int d, a;
    char c;
    int r = 90;
    double x, y;

    while (cin >> d >> c >> a) {
        if (d == 0 && a == 0) {
            break;
        }
        else {
            double ans = r * (PI / 180.0);
            x += d * cos(ans);
            y += d * sin(ans);
            r += a;
        }
    }
    cout << -1 * (int)x << endl;
    cout << (int)y << endl;

    return (0);
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){
    double x=0,y=0,a,b,an=90;
    char c;
    while(cin>>a>>c>>b,a,b){
        x+=a*cos(an/180.0*M_PI);
        y+=a*sin(an/180.0*M_PI);
        an-=b;
    }
    cout<<(int)x<<endl<<(int)y<<endl;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double pi=3.14159265359;
int main(){
  double now=pi*0.5;
  double x=0.0,y=0.0;
  while(1){
    double a,b;
    scanf("%lf,%lf",&a,&b);
    if (a==0.0 and b==0.0)break;
    double xx=0.0,yy=0.0;
    xx=cos(now)*a;
    yy=sin(now)*a;
    x+=xx;
    y+=yy;
    now-=(b/180*pi);
    if(now>=2*pi)now-=2*pi;
    if(now<=-2*pi)now+=2*pi;
    
    
    
  }  
  printf("%.0lf %.0lf\n",x,y);
}

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

int main() {
  int w;
  double ang = M_PI/2; int angInt;
  char c;
  double x = 0.0, y = 0.0;

  while(cin>>w>>c>>angInt, w != 0 && angInt != 0) {
    x += w * cos(ang), y += w * sin(ang);
    ang -= angInt*M_PI/180.0;
  }
  printf("%d\n%d\n", (int)x, (int)y);
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define PI 3.14159265
using namespace std;
int main() {
  int len, rot;
  float x, y, shita;
  x = y = shita = 0;
  while(1) {
    scanf("%d,%d", &len, &rot);
    if (len == 0 && rot == 0) {
      break;
    }
    x += len * cos(shita * PI / 180);
    y += len * sin(shita * PI / 180);
    shita += rot;
  }
  cout << (int)y <<  endl;
  cout << (int)x << endl;
  return 0;
}

C++: //Treasure Hunt
#include<bits/stdc++.h>
using namespace std;

#define PI 3.141592

int main(){
  int tmp1, tmp2;
  double r=90.0, nx=0.0, ny=0.0;

  while(true){
    scanf("%d,%d", &tmp1, &tmp2);
    if(tmp1==0 && tmp2==0)break;
    //printf("sin=%f cos=%f\n", sin(r/RAD), cos(r/RAD));
    nx+=tmp1*cos(r*PI/180);
    ny+=tmp1*sin(r*PI/180);
    r+=tmp2;
    //printf("nx=%f, ny=%f\n", nx, ny);
  }
  printf("%d\n%d\n", (int)nx*(-1), (int)ny);

  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Here your code !
 int r,p,f=90;
 char c;
 double x=0,y=0;
 
 while(cin>>r>>c>>p){
   if(r==0&&p==0) break;  
   
   x=x+r*cos(f*M_PI/180.0);
   y=y+r*sin(f*M_PI/180.0);
   f=f-p;
 }
 cout<<(int)x<<endl<<(int)y;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

#define PI 3.1415926535897932

int main(){
    int a,b,theta=90;
    double x=0,y=0,pi=PI;
    for(;;){
        scanf("%d,%d",&a,&b);
        if(a==0 && b==0){
            break;
        }
        y+=a*sin(theta/180.0*pi);
        x+=a*cos(theta/180.0*pi);
        theta+=b;
    }
    printf("%d\n%d\n",(int)-x,(int)y);
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
double toRad(int deg){
	return deg/180.0*M_PI;
}
main(){
	double x=0,y=0;
	int len,deg=90;
	double rad=toRad(deg);
	while(1){
		int tdeg;
		scanf("%d,%d",&len,&tdeg);
		if(len==tdeg && len==0){
			break;
		}
		double tx=len*cos(rad);
		double ty=len*sin(rad);
		x+=tx;
		y+=ty;
		deg-=tdeg;
		rad=toRad(deg);
	}
	cout<<(int)x<<endl<<(int)y<<endl;
}

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?????????
		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;
}

C++: #define _USE_MATH_DEFINES

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cmath>

using namespace std;

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