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: import sys
import math

def TreasureHunt():
    x,y=(0.0,0.0)
    alpha=90
    
    for line in sys.stdin:
        a,b=list(map(int,line.split(',')))
        if a==0 and b==0:
            break
        
        x+=a*math.cos(alpha/180.0*math.pi)
        y+=a*math.sin(alpha/180.0*math.pi)
        alpha=(alpha-b+360)%360

    print(int(x),'\n',int(y))

        
        
            
TreasureHunt()

Python: import math

x, y, r = 0, 0, 90
while True:
    d, t = map(float, 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: deg = 0.0
x = 0.0
y = 0.0
from math import pi, cos,sin
while(1):
    a,b = [int(i) for i in input().split(",")]
    if a == 0.0 and b==0.0:
        print(int(y))
        print(int(x))
        break
    else:
        x += a*cos(deg*pi/180)
        y += a*sin(deg*pi/180)
        deg += b

Python: import math
X = Y = a = 0
while True:
	x,y = map(int,input().split(','))
	if x == y == 0:
		break
	r = a * math.pi / 180
	X += x*math.sin(r)
	Y += x*math.cos(r)
	a+=y
print(*map(int,(X,Y)),sep='\n')

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

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

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

print("{0:.0f}".format(x))
print("{0:.0f}".format(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))

Python: import sys
import math as mas

x,y,d=0,0,90
for t in sys.stdin:
	a,b=map(int,t.split(','))
	if a==b==0:break
	x+=a*mas.cos(mas.radians(d))
	y+=a*mas.sin(mas.radians(d))
	d-=b
print(int(x))
print(int(y))
#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Python: from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin
from math import radians
from cmath import rect

p = 0+0j
prev_angle = radians(-90)
for line in stdin:
    m, next_angle = (int(i) for i in line.split(','))
    if not (m or next_angle):
        break
    p += rect(m, -prev_angle)
    prev_angle += radians(next_angle)
print('{}\n{}'.format(int(p.real), int(p.imag)))

Python: import math
import cmath

coordinates = 0
ang = 90
while True:
    line = list(map(float, input().split(",")))
    if line[0] == 0 and line[1] == 0:
        break

    coordinates += cmath.rect(line[0], math.radians(ang))
    ang -= line[1]

print(int(coordinates.real))
print(int(coordinates.imag))

Python: import math

if __name__ == '__main__':

	x = y = 0
	deg = 90

	while True:

		d,a = map(int,input().split(","))
		if d == 0 and a == 0:
			break

		x += math.cos(math.radians(deg)) * d
		y += math.sin(math.radians(deg)) * d

		deg -= a

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

Python: treasure_x, treasure_y = 0, 0

while True:
    x, y = map(int, input().split(','))

    if x == 0 and y == 0:
        break

    treasure_x += x
    treasure_y += y

print(treasure_x)
print(treasure_y)

Python: from math import sin,cos,pi

def rad(ang):
  return pi/180 * ang

x = y = 0
ang = 90

while True:
  dist, next_ang = map(int, input().split(','))
  x += dist * cos(rad(ang))
  y += dist * sin(rad(ang))
  ang += -1 * next_ang
  if dist == 0 and next_ang ==0:
    break

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

Python: import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 

print(int(ystep))
print(int(xstep))

Python: from math import radians
from cmath import rect

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

Python: #!/usr/bin/python
# AOJ
# 0016

import math

degree = 90
x = 0
y = 0

while True:
    a, b = map(int, input().split(','))
    if a is 0 and b is 0: break
    x += a * math.cos(math.radians(degree))
    y += a * math.sin(math.radians(degree))
    degree -= b
    if degree > 360:
        degree -= 360
    elif degree < 0:
        degree += 360
print(int(x))
print(int(y))

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

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(floor(x))
print(floor(y))

Python: import math
x = 0.0
y = 0.0
ang = 0.5*math.pi
while True:
    d, a = map(float, input().split(","))
    if d == 0 and a == 0:
        break
    x += d*math.cos(ang)
    y += d*math.sin(ang)
    ang += math.radians(-a)
print(int(x))
print(int(y))

Python: import math
x,y=(int(i) for i in input().split(','))
theta=1/2*math.pi
Ansy=0
Ansx=0
while(x!=0 or y!=0):
    Ansy=Ansy+x*math.sin(theta)
    Ansx=Ansx+x*math.cos(theta)
    theta=theta-y/180*math.pi
    x,y=(int(i) for i in input().split(','))
print(int(Ansx))
print(int(Ansy))

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 = floor(x + D[i] * cos(A[i] * pi / 180))
    y = floor(y - D[i] * sin(A[i] * pi / 180))
print(x)
print(y)

Python: from math import cos, sin, pi

treasure_x, treasure_y = 0, 0
angle = pi / 2

while True:
    d, a = map(int, input().split(','))

    if d == 0 and a == 0:
        break

    treasure_x += d * cos(angle)
    treasure_y += d * sin(angle)

    angle += a * 2 * pi / 180


print(int(treasure_x))
print(int(treasure_y))

Python: import sys, cmath, math
t = complex(0)
a = math.pi/2
for line in sys.stdin:
    l = list(map(int, line.split(",")))
    if l == [0, 0]:
        break
    t += cmath.rect(l[0], a)
    a -= l[1]*math.pi/180
print(int(t.real))
print(int(t.imag))

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),sep='\n')