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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
double digrad(double dig) { return dig*M_PI / 180.0; }
int main() {
	double d, a,q=90;
	double x = 0, y = 0;
	char f;

	double rad=M_PI*q/180;
	while (true) {
		cin >> d >> f >> a;
		if (d == 0 && a == 0)break;
		x += d*cos(digrad(q));
		y += d*sin(digrad(q));
	????????????//cout << "x: " << x << "  y: " << y << endl;
		q -= a;
	}
	x = (int)x;
	y = (int)y;
	cout << x << endl << y << endl;

	return 0;
}

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

int main(){
	double x,y,dx,dy,pi,d,rad,prad;
	char camma;
	x=y=0;
	pi=3.14159265359;
	prad=0;
	while(cin>>d>>camma>>rad){
		if(d==0 && rad==0)break;
		dx=d*cos((rad+prad)*pi/180);
		dy=d*sin((rad+prad)*pi/180);
		x+=dx;
		y+=dy;
		prad=rad+prad;
		//cout<<"x:"<<x<<endl;
		//cout<<"y:"<<y<<endl;
	}
	cout<<(int)x<<endl;
	cout<<(int)y<<endl;
	while(1);
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
#define PI 3.141592653589793
using namespace std;

int main(){
	double x = 0, y = 0;

	int l, a;

	while(scanf("%d,%d",l,a) != -1){
		x += l * cos(a * PI / 180);
		y += l * sin(a * PI / 180);
	}

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

	return 0;
}

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

#define PI 3.1415926535897932386

using namespace std;

int main(void){
	int i,j,angle=0;
	double x=0.0, y=0.0;
	while(scanf("%d,%d",&i,&j) != EOF){
		if(i==0&&j==0) break;
		x+= (double)(i)*sin((double)angle*PI/180);
		y+= (double)(i)*cos((double)angle*PI/180);
		angle += j;
	}
	cout << (int)x << "\n" << (int)y << "\n";
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   double a,b,x=0,y=0,rad;
   char c;
   
   while(1){
      cin >> a >> c >> b;
      if(a+b==0) break;
      x+=a*cos(M_PI*rad/180);
      y+=a*sin(M_PI*rad/180);      
      rad-=b;
      //cout << x << endl;
      //cout << y << endl;
      //cout << rad << endl;
   }
   int ai, bi;
   ai=x; bi=y;
   cout << -bi << endl;
   cout << ai << endl;
   
   return 0;
}

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

int main(){
	int arg=90;
	double x=0, y=0; 
	
	while(1){
		int a, b;
		 scanf(" %d,%d", &a, &b);
		if(a==0 && b==0) break;
		x+=a*cos(arg*2*M_PI/360);
		y+=a*sin(arg*2*M_PI/360);
		arg-=b;
	}
	
	printf("%d\n%d\n", (int)x, (int)y); 
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
&#160;
void walk(double current_point[2], int r, int sum_theta) {
&#160; &#160; double pi = 3.14159265358979;&#160;
&#160; &#160; double rad = ((double)sum_theta / 180) * pi;
&#160; &#160; current_point[0] += r * sin(rad);
&#160; &#160; current_point[1] += r * cos(rad);
}
&#160;
int main() {
&#160; &#160; int r;
&#160; &#160; int theta;
&#160; &#160; int sum_theta = 0;
&#160; &#160; double current_point[2] = {0, 0};
&#160;
&#160; &#160; do {
&#160; &#160; &#160; &#160; scanf("%d,%d", &r, &theta);
&#160;
&#160; &#160; &#160; &#160; walk(current_point, r, sum_theta);
&#160; &#160; &#160; &#160; sum_theta += theta;
&#160; &#160; } while(r || theta);
&#160;
&#160; &#160; printf("%d\n", (int)current_point[0]);
&#160; &#160; printf("%d\n", (int)current_point[1]);
&#160;
&#160; &#160; return 0;
}

C++: #define RAD M_PI/180
#include <math.h>
#include <iostream>
using namespace std;
int main()
{
	int  move, angle;
	double x = 0, y = 0, theta = 90;
	
	while (scanf("%d,%d", &move, &angle), (move != 0) && (move != 0)) {
		x += (double)move * cos(theta*RAD); y += (double)move * sin(theta*RAD);
		theta -= angle;
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

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

using namespace std;

int main() {
    int a=1;
    int b=1;
    
    double degree=90.0;
    
    double x=0.0;
    double y=0.0;

    while (a!=0&&b!=0){
        scanf("%d,%d",&a,&b);
        
        y+=(a*sin(degree* M_PI / 180));
        x+=(a*cos(degree* M_PI / 180));
        
        degree-=b;
    }
    
    cout<<(int)x<<" "<<(int)y<<endl;
    
    return 0;
}

C++: /*AOJ 0016*/
 
#include<iostream>
#include<math.h>
 
#define M_PI 3.14159265
 
using namespace std;
 
double changeDegToRad(double deg){
 
    return deg*M_PI/180.0;
 
}
 
int main(){
 
    double x = 0,y = 0;
    double deg = 0,walk = 0;
    double rad = M_PI/2.0;
    while(1){
        scanf("%lf,%lf",&walk,&deg);
 
 
        if(deg==0&&walk==0){
            break;
        }
 
        x += walk * cos(rad);
        y += walk * sin(rad);
 
        rad -= changeDegToRad(deg);
 
    }
 
    cout<<(int)x<<endl;
    cout<<(int)y<<endl;
    return 0;
}