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: 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: 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 * pi / 180

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

Python: import math
x = 0
y = 0
r = 90
while True:
    d,t=map(int, input().split())
    if d==0 and t==0:
        print(int(x),int(y),sep='\n')
        exit()
    x += math.cos(math.radians(r)) * d
    y += math.sin(math.radians(r)) * d
    r -= t

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

Python: # Aizu Problem 0016: Treasure Hunt
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


x, y = 0, 0
direction = 90
while True:
    d, t = [int(_) for _ in input().split(',')]
    if d == t == 0:
        break
    angle = direction * math.pi / 180
    x += d * math.cos(angle)
    y += d * math.sin(angle)
    direction = (direction - t) % 360
    
print(int(x))
print(int(y))

Python: import sys
import math
def sign(x):
    if x>=0:
        return 1.0
    else:
        return -1.0

pi = math.pi
deg = 0.0
pos_x = 0.0
pos_y = 0.0

lines = sys.stdin.readlines()
for line in lines:
    line = line.split(",")
    inp = []
    for i in line:
        inp.append(int(i))
    if inp[0]>0:
        dist = inp[0]
        pos_x += dist*math.sin(deg/180*pi)
        pos_y += dist*math.cos(deg/180*pi)
        deg += inp[1]
    else:
        print ("%d" % (sign(pos_x)*math.floor(math.fabs(pos_x))))
        print ("%d" % (sign(pos_y)*math.floor(math.fabs(pos_y))))

Python: # AOJ 0016 Treasure Hunt
# Python3 2018.6.15 bal4u

import math

PI = 3.1415926535897932384626433832795
M = 0.01745329251994329576923690768489
EPS = 1e-8

r, q, f = 0, 90*M, 0
while True:
	d, a = list(map(int, input().split(',')))
	if d == 0 and a == 0: break
	r2 = math.sqrt(r*r + d*d - 2*r*d*math.cos(PI - math.fabs(f)))
	if math.fabs(r) < EPS or math.fabs(r2) < EPS:
		q2 = q - f
		f = a * M
	else:
		t = math.acos((r*r + r2*r2 - d*d) / (2 * r*r2));
		if f >= 0:
			q2 = q - t
			f += a*M - t
		else:
			q2 = q + t
			f += a*M + t
	r = r2
	q = q2
print(int(r * math.cos(q)), int(r * math.sin(q)), sep='\n')

Python: import math
import sys

x, y, r = 0, 0, 90
for i in sys.stdin.readlines():
    d, a = [int(z) for z in i.split(',')]
    if d == a == 0:
        break
    x += d * math.cos(math.radians(r))
    y += d * math.sin(math.radians(r))
    r -= a

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

Python: import math

class Pos():
    x = 0
    y = 0
    direction = math.radians(90)

cur_pos = Pos()

while True:
    d, a = [int(i) for i in input().split(",")]
    if d == 0 and a == 0:
        break
    cur_pos.x += d * math.cos(cur_pos.direction)
    cur_pos.y += d * math.sin(cur_pos.direction)
    cur_pos.direction -= math.radians(a)
    #print(cur_pos.x, cur_pos.y, math.degrees(cur_pos.direction))
print(int(cur_pos.x))
print(int(cur_pos.y))

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
  x += math.cos(angle) * d
  y += math.sin(angle) * d
  angle -= a * math.pi / 180
print(int(x), int(y), sep="\n")

Python: import math

x = 0
y = 0
alpha = 90

while True:
    a, b = map(int, input().split(','))
    if a == b == 0:
        break
    
    x += a * math.cos(alpha / 180 * math.pi)
    y += a * math.sin(alpha / 180 * math.pi)
    
    alpha -= b
    
print(int(x))
print(int(y))

Python: from math import *
def rad(n):
    return n * pi / 180

x, y = 0, 0
na = 90
while True:
    d, a = map(int, input().split(","))
    if d == a == 0:
        print(int(x))
        print(int(y))
        break
    x += cos(rad(na)) * d
    y += sin(rad(na)) * d
    na -= a

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: from math import sin, cos
from math import radians as rad
x, y, t = 0, 0, 0
while(1):
    a, b = map(int,input().split(','))
    if (a == b == 0): break;
    x += a * sin(rad(t))
    y += a * cos(rad(t))
    t += b
print(int(x))
print(int(y))

Python: import math

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

Python: from math import radians, sin, cos

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

Python: import math

x = 0
y = 0
angle = math.pi / 2

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

    x += math.cos(angle) * d
    y += math.sin(angle) * d
    angle -= a * math.pi / 180

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

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

cl = [0, 0]
cd = 0

while True:
    o = input()
    if o == (0, 0):
        break

    cl[0] += o[0] * math.sin(cd)
    cl[1] += o[0] * math.cos(cd)
    cd += math.radians(o[1])

for x in cl:
    print(int(math.floor(x)))

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 = x + D[i] * cos(sum_a * pi / 180)
    y = y - D[i] * sin(sum_a * pi / 180)
    if abs(x-round(x))<10**(-5):
        x=round(x)
    if abs(y - round(y)) < 10 ** (-5):
        y=round(y)
    sum_a += A[i]
print(floor(x))
print(floor(y))

Python: from math import *
coordinate=[0,0]
degree = 0
while True:
  dist,delta_degree = list(map(int,input().split(",")))
  if [dist,delta_degree]==[0,0]:
    break
  coordinate[0] += dist*sin(degree*pi/180)
  coordinate[1] += dist*cos(degree*pi/180)
  degree += delta_degree
for c in coordinate:
  print(int(c))