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 <bits/stdc++.h>
using namespace std;
using ld = long double;

int main()
{
	char c;
	int d, a;
	ld x = 0, y = 0;
	int deg = 90;
	while (cin >> d >> c >> a, d | a) {
		ld ar = deg * acosl(-1) / 180;
		x += d * cosl(ar);
		y += d * sinl(ar);
		deg -= a;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define MY_PI 3.1415926535897932384626433832795028841971693993751058209749445923
using namespace std;

int main() {
	double sumx=0, sumy=0;
	int ideg = 0;
	while(true) {
		int a,b; scanf("%d,%d",&a,&b);
		if(a==0 && b==0)break;
		sumx += a*sin(ideg*MY_PI/180);
		sumy += a*cos(ideg*MY_PI/180);
		ideg = (ideg+b)%360;
		if(ideg<0)ideg+=360;
	}
	printf("%d\n%d\n",(int)sumx,(int)sumy);
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main(){
int step,turn;
double x=0,y=0,angle;
while(scanf("%lf,%lf",&step,&turn)){
if(!step&&!turn)break;
x+=(double)step*sin(angle*M_PI/180);
y+=(double)step*cos(angle*M_PI/180);
angle+=(double)turn;
}
cout << (int)x << endl;
cout << (int)y << endl;
return 0;
}

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

int main()
{
  int n;
  double x, y, deg, rad;
  
  x = y = deg = rad = 0;
  while (1){
    scanf("%d,%lf", &n, &deg);
    if (n == 0 && deg == 0){
      break;
    }
    x += cos(rad) * n;
    y += sin(rad) * n;
    deg = deg / 180 * M_PI;
    rad += deg;
  }
  printf("%.0f\n%.0f\n", y, x);
  //cout << x << "\n" << y << endl;
  return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
#define M_PI 3.14159265358979 /* 円周率 */

using namespace std;

int main(){
	int len, deg;
	int deg_now = 90;
	double x = 0, y = 0;

	while (1){
		scanf("%d,%d", &len, &deg);
		if (len == 0 && deg == 0) break;
		x += len*cos(deg_now / 180 * M_PI);
		y += len*sin(deg_now / 180 * M_PI);
		deg_now -= deg;
	}

	cout << (int)x << endl << (int)y << endl;

	return 0;

}

C++: import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep='\n')

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  double angle=90,x=0,y=0,pi=3.141592653589793;
  int d,a;
  while(cin >> s){
    if(s=="0,0"){
      cout << (int)x << endl << (int)y << endl;
      return 0;
    }
    for(int i=0;i<s.size();i++){
      if(s[i]==','){
        string ss=s.substr(0,i),tt=s.substr(i+1,s.size()-i-1);
        d=atoi(ss.c_str()),a=atoi(tt.c_str());
      }
    }
    x+=cos(pi*(angle)/180)*(double)d;
    y+=sin(pi*(angle/180))*(double)d;
    angle-=(double)a;
  }
  return 0;
}

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

#define PI 3.14159265

using namespace std;

int main(){
  int theta,x,theta_sum;
  double x_sum,y_sum;
  
  x_sum =0;
  scanf("%d,%d",&x,&theta);
  y_sum = (double)x,theta_sum =(double)theta;
  while(1){
    scanf("%d,%d",&x,&theta);
    if(x == 0 && theta == 0) break;
    x_sum += (double)x * sin(theta_sum * PI / 180);
    y_sum += (double)x * cos(theta_sum * PI / 180);
    theta_sum += theta;
  }

  cout << floor(x_sum) << endl <<floor(y_sum) << endl;

  return 0;

}

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

int main(){
	int ang=90, walk, inang;
	double x=0.0, y=0.0, rad;
	while(true){
		scanf("%d,%d", &walk, &inang);
		if(walk==0 && inang==0) break;
		rad=ang*M_PI/180.0;
		x = x+( (double)walk*cos(rad) );
		y = y+( (double)walk*sin(rad) );
		ang = (ang-inang)%360;
	}
	cout<<int(x)<<endl<<int(y)<<endl;
	return 0;
}

C++: #include<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>

using namespace std;
int main(void)
{
	int x = 0,y = 0;
	int hosu,kakudo;
	int kakudos = 90;
	while(scanf("%d,%d",&hosu,&kakudo))
	{
		if(hosu == 0 && kakudo == 0) break; 
		x += cos(kakudos * M_PI / 180) * hosu;
		y += sin(kakudos * M_PI / 180) * hosu;
		kakudos -= kakudo;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

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

int main(){
	int ang=90, walk, inang;
	double x=0.0, y=0.0, rad;
	while(true){
		scanf("%d,%d", &walk, &inang);
		if(walk==0 && inang==0) break;
		rad=ang*M_PI/180.0;
		x = x+( (double)walk*cos(rad) );
		y = y+( (double)walk*sin(rad) );
		ang = (ang-inang)%360;
	}
	printf("%.0f\n%.0f\n", x, y);
	return 0;
}

C++: d;double x,y,c;main(s){for(;~scanf("%d,%d",&s,&d);c+=d/57.29578)x+=s*sin(c),y+=s*cos(c);exit(!printf("%d\n%d\n",d=x,s=y));}

C++: #include <cmath>
#include <cstdio>
int a, b; double x, y, r;
int main() {
	r = asin(1);
	while(scanf("%d,%d", &a, &b), a | b) {
		x += a * cos(r), y += a * sin(r);
		r -= b / 180.0 * acos(-1);
	}
	printf("%d\n%d\n", (int)(x), (int)(y));
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double x=0,y=0,rad=M_PI/2;
	int a,b;
	while(1){
		cin>>a;
		cin.ignore();
		cin>>b;
		if(!a&&!b)break;
		x += a*cos(rad);
		y += a*sin(rad);
		rad -= b*M_PI/180;
	}
	cout<<(int)x<<endl<<(int)y<<endl;
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
const double PI = 3.141592653583;
#define DegreeToRadian(Degree) ((float)Degree * (PI / 180.0f))

int main()
{
	int x, r, R = 0;
	pair<double, double> point = mp(0, 0);

	while(cin >> x >> r && (x || r))
	{
		R = min(R, 360);

		point.first += sin(DegreeToRadian(R)) * x;
		point.second += cos(DegreeToRadian(R)) * x;

		R += r;
	}

	pint res = mp(RoundOff(point.first), RoundOff(point.second));
	printf("%d\n%d\n", res.first, res.second);
}