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
//------------------------------------------
#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;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

const double PI = 3.1415926535;

signed main(){
    double x = 0, y = 0;
    int d, a, next = 90;
    while(1){
        char c;
        cin >> d >> c >> a;
        if(d == 0 && a == 0) break;
        x += (double)d * cos(next * PI / 180.0);
        y += (double)d * sin(next * PI / 180.0);
        next -= a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
}

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

using namespace std;

double deg2rad(int degree) {
  return degree / 360.0 * 2 * M_PI;
}

int main() {
  double x = 0, y = 0;
  int length, degree;
  int direction = 90;

  while (true) {
    scanf("%d,%d", &length, &degree);
    if (length == 0 && degree == 0) { break; }

    double rad = deg2rad(direction);
    x -= length * cos(rad);
    y += length * sin(rad);

    direction += degree;
  }

  printf("%d\n%d\n", static_cast<int>(x), static_cast<int>(y));

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int d, a;
    double x = 0, y = 0;

    int angle = 90;
    while (true)
    {
        scanf("%d,%d", &d, &a);
        if (d == 0 && a == 0)
            break;
        x = x + d * cos(angle * M_PI / 180);
        y = y + d * sin(angle * M_PI / 180);

        angle -= a;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;
    return 0;
}

C++: #include<cstdio>
#include<cmath>
int main(){
	int w,angle;
	double x=0.0,y=0.0, prev_angle=0.0;
	while(scanf("%d,%d",&w,&angle) != EOF){
		if(w==0 && angle==0) break;
		double radian_angle = angle * M_PI / 180.0;
		x += (double)w*cos(radian_angle);
		y += (double)w*sin(radian_angle);
		
		prev_angle += (double)angle;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}