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>
#define PI 3.14159265359
using namespace std;

int main(){
  int d, a = 90, a2; 
  double x,y;
  char c;
  while(cin >> d >> c >> a2){
    if(d == 0 && a == 0) break;
      double rad = a * (PI / 180);
      x += d * cos(rad);
      y += d * sin(rad);
      a += a2;
    }
  cout << (int)x << "\n" << (int)y << endl;
}

C++: #include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
 
using namespace std;
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double x = 0, y = 0;
	double m, d;
	char c;
	double next = 0;
	while(cin >> m >> c >> d && (m != 0 || d != 0) ){
		double rad = (90 - next) / 180.0 * M_PI;
		x += m * cos(rad);
		y += m * sin(rad);
		next += d;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#define add push_back
#define inf 2147000000
#define pi 3.1415926535

#define rep(i,n) for(int i=0;i<n;i++)
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	double x,y,kk=pi/2;
	string str;
	char* bin;
	x=0;y=0;
	while(1){
		cin>>str;
		int t = str.find(',');
		string st1 = str.substr(0,t);
		string st2 = str.substr(t+1);
		
		double a1,a2;
		bin = &st1[0];
		a1=atoi(bin);
		bin = &st2[0];
		a2=atoi(bin);
		
		if(a1==0 && a2==0){
			break;
		}
		x+=cos(kk)*a1;
		y+=sin(kk)*a1;
		
		kk-=(double)a2/180*pi;
	}
	printf("%.0lf\n%.0lf\n",x,y);
}

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

#define PI (3.141592)

int main()
{
	int hosu, angle,angleplus;
	angle = 0;
	double x = 0,y=0;
	char c;
	while( cin >> hosu >> c >> angleplus ) {
		if( hosu == 0 && angleplus == 0 )
			break;
		x += hosu * sin(angle * PI / 180 );
		y += hosu * cos(angle * PI / 180 );
		angle += angleplus;
		
	}
	printf("%d\n%d",(int)x,(int)y);

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	const double EPS=1e-6;
	double x=0,y=0;
	double dir=M_PI/2;
	for(int a,d;scanf("%d,%d",&a,&d),a|d;){
		x+=a*cos(dir);
		y+=a*sin(dir);
		dir-=d*M_PI/180;
	}
	printf("%d %d\n",int(x+EPS),int(y+EPS));
	
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979

int main(void)
{
	int i=0,a,b,k=90;
	double x=0,y=0;

	while(i == 0)
	{
		scanf("%d,%d",&a,&b);

		if(a == 0 && b == 0)break;

		x += cos(k * M_PI / 180)*a;
		y += sin(k * M_PI / 180)*a;
		k -= b;
	}
  printf("%d\n",(int)x);
  printf("%d\n",(int)y);

  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	double cx = 0, cy = 0;
	double angle = 90;
	for(int l, r; scanf("%d,%d", &l, &r) && l && r;) {
		double rad = angle * PI / 180.0;
		cx += l * cos(rad);
		cy += l * sin(rad);
		angle -= r;
#if 0
		cout << "before" << endl;
		cout << rad << endl;
		cout << cx << endl;
		cout << cy << endl;
		cout << "after" << endl;
#endif
	}
	printf("%d\n%d\n", (int)cx, (int)cy);
	return 0;
}

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

int main() {
  double pi=3.14159265358979;
  double x=0, y=0, r=-pi/2;

  while(1) {
    int z,nr;
    scanf("%d%*c%d",&z,&nr);
    if(z==0 && nr==0) break;

    x += z*cos(r);
    y += z*sin(r);
    r -= nr*pi/180;
  }
  cout << -(int)x << endl << -(int)y << endl;
  return 0;
}

C++: /*Filename: aoj0016.cpp
 *Author: Mushiyo
 */

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

using namespace std;

int main() {
	double x = 0, y = 0;
	int direction = 90;
	int d = 0, t = 0;

	while (scanf("%d, %d", &d, &t) == 2) {
		if (d == 0 && t == 0) {
			break;
		}

		double dx = d * cos(direction * M_PI / 180.0);
		double dy = d * sin(direction * M_PI / 180.0);

		x += dx;
		y += dy;

		direction -= t;
		direction %= 360;
		if (direction < 0) {
			direction += 360;
		}
	}

	printf("%.0f\n", x);
	printf("%.0f\n", y);

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double nx=0,ny=0,x,y,ro=90;
	while(true){
		cin>>x;cin.ignore();cin>>y;	
		if(x==0&&y==0)break;
		ny+=x*sin(ro/180*M_PI);
		nx+=x*cos(ro/180*M_PI);
		ro-=y;
		//if(ro<0)ro=360-abs(ro);
		//cout<<nx<<" "<<ny<<endl;
	}
	cout<<(int)nx<<endl<<(int)ny<<endl;
	return 0;
}