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))
}

Python: # coding=utf-8
import math

x = 0
y = 0
direction = math.pi/2
while True:
    d, a = map(int, input().split(','))
    if d == 0 and a == 0:
        break
    x += d * math.cos(direction)
    y += d * math.sin(direction)
    direction -= a*math.pi/180
print('{0:.0f}'.format(math.modf(x)[1]))
print('{0:.0f}'.format(math.modf(y)[1]))

Python: from math import *

x = 0
y = 0
D = []
A = []
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x = x + D[i] * cos(A[i] * pi / 180)
    y = y + D[i] * sin(A[i] * pi / 180)
print(x,y)

Python: import math
x=0
y=0
d=90
cos=lambda x:round(math.cos(math.radians(x)),10)
sin=lambda x:round(math.sin(math.radians(x)),10)

while True:
    try:h,r=[int(i) for i in input().split(",")]
    except:break
    if h==0 and r==0:break
    x+=h*cos(d)
    y+=h*sin(d)
    d+=-r
print("{0}\n{1}".format(int(x),int(y)))

Python: 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')

Python: from math import radians,sin,cos,pi
def main():
    x = 0
    y = 0
    a = 0
    while True:
        d,_a = map(int,input().split(","))
        if(d == _a == 0):
            break
        x = x + d*cos(radians(a))
        y = y + d*sin(radians(a))
        a = a + _a
    print(int(y))
    print(int(x))

if __name__ == '__main__':
    main()

Python: from math import *

x = 0
y = 0
D = []
A = []
sum_a = -90
while True:
    d, a = map(int, input().split(","))
    if a == 0 and d == 0:
        break
    else:
        D.append(d)
        A.append(a)
for i in range(len(A)):
    x += D[i] * cos(-sum_a * pi / 180)
    y += D[i] * sin(-sum_a * pi / 180)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Python: from math import sin,cos,pi
x = 0
y = 0
ca = pi/2
while True:
    d, a = list(map(int, input().split(",")))
    if d or a:
        x += d*cos(ca)
        y += d*sin(ca)
        ca -= a*pi/180
    else:
        break

print("{0:.0f}".format(x))
print("{0:.0f}".format(y),end="")

Python: import math
a = 0
b = 0
r = 0
while True:
	n,m = map(int,raw_input().split(','))
	if n==0 and m==0:
		break
	a += n * math.sin(math.radians(r))
	b += n * math.cos(math.radians(r))
	r += m
print(int(a))
print(int(b))

Python: import math
x = y = 0
h = math.radians(90)
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += d * math.cos(h)
    y += d * math.sin(h)
    h -= math.radians(t)
print("{} {}".format(int(x), int(y)))

Python: # coding: utf-8

import math

def RadToDeg(rad):
	return rad*180/math.pi

def DegToRad(deg):
	return deg*math.pi/180

deg = 90
x = 0.
y = 0.

while True:
	d, theta = map(int, raw_input().split(","))
	if d == 0 and theta == 0:
		break
	else:
		x += d * math.cos(DegToRad(deg))
		y += d * math.sin(DegToRad(deg))
		deg -= theta
print(int(x))
print(int(y))

Python: import math


def main():
    p = [0, 0]
    x = math.radians(90)
    while True:
        d, angle = map(int, input().split(","))
        if d == 0 and angle == 0:
            break
        p[0] += math.cos(x) * d
        p[1] += math.sin(x) * d
        x -= math.radians(angle)
    for i in (0,1):
        p[i] = int(p[i])
    print(*p, sep="\n")


if __name__ == "__main__":
    main()

Python: import sys
import math

x,y,t = 0,0,0

for s in sys.stdin:
    a,b = map(int,s.split(','))
    if a==0 and b==0:
        break
    x += a*math.sin(math.radians(t))
    y += a*math.cos(math.radians(t))
    t += b

print(int(x))
print(int(y))

Python: import cmath,math,sys
z=0;p=90
for e in sys.stdin:
 r,d=map(int,e.split(','))
 z+=cmath.rect(r,math.radians(p))
 p-=d
print(int(z.real),int(z.imag))

Python: from math import radians
from cmath import rect

z = 0
deg = 90
while True:
    r, d = map(int, input().split(','))
    if r == d == 0: break
    z += rect(r, radians(deg))
    deg -= d
print(int(z.real), int(z.imag))

Python: 56,65
97,54
64,-4
55,76
42,-27
43,80
87,-86
55,-6
89,34
95,5
0,0

Python: # 0016
import math as m
x,y,d=0,0,90
while True:
    r,t=map(int,input().split(","))
    if (r,t)==(0,0):
        break
    x+=r*m.cos(m.radians(d))
    y+=r*m.sin(m.radians(d))
    d-=t
print(int(x))
print(int(y))

Python: import math
 
x, y ,angle = 0, 0, 90
while True:
  line = map(int, raw_input().split(','))
  if line[0] == 0 and line[1] == 0: break
  radian = math.radians(angle)
  x += math.cos(radian) * line[0]
  y += math.sin(radian) * line[0]
  angle -= line[1]
 
print(int(x))
print(int(y))

Python: 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=',')

Python: import math

x, y, r = 0, 0, 90
while True:
    d, t = map(int, input().split(","))
    if d == t == 0:
        break
    x += r * math.cos(math.radians(r))
    y += r * math.sin(math.radians(r))
    r -= t
print(int(x))
print(int(y))

Python: import math
A = math.radians(90)
aD = 90
x = y = 0
while 1:
    user = input().split(",")
    r = int(user[0])
    if r == 0 and int(user[1]) == 0:
        break
    x += r * math.cos(A)
    y += r * math.sin(A)
    aD -= int(user[1])
    A = math.radians(aD)
print(int(x))
print(int(y))

Python: import math

def calc(x, y, r, d, nd):
	x = x + r * math.cos(math.radians(d))
	y = y + r * math.sin(math.radians(d))
	d -= nd
	return x, y, d

x = y = 0
d = 90

while True:
	r, nd = map(int, input().split(","))
	if r == nd == 0: break
	x, y, d = calc(x, y, r, d, nd)

print(int(x))
print(int(y))

Python: import cmath,math,sys
z=0;p=90
for e in sys.stdin:
 r,d=map(int,e.split(','))
 z+=cmath.rect(r,math.radians(p))
 p-=d
print(int(z.real),'\n',int(z.imag))

C++: #include <iostream>
#include <sstream>
#include <cmath>
#include <fstream>

using namespace std;

int length, angle, currentAngle;
double px, py;

void walk(void)
{
	px += length * cos (currentAngle * M_PI/180. );
	py += length * sin (currentAngle * M_PI/180. );
	currentAngle -= angle;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.th", "r", stdin);
	string str = "";
	px = py = 0.;
	currentAngle = 90;

	while (getline (cin, str ) ){
		str = str.replace (str.find (','), 1, " " );
		stringstream ss(str);
		ss >> length >> angle;		
		if (length == 0 && angle == 0 ){
			break;
		} // end if
		walk();
	} // end while

	cout << (int)px << endl;
	cout << (int)py << endl;	
	
	return 0;
}