import math

pi=3.14159265358979



def radians(x):

    return 1.0*x/180*pi

    

x = 0

y = 0

theta = radians(90)



while True:

    a, b = list(map(float, input().split(',')))

    if a==0 and b==0: break

    x += a * math.cos(theta)

    y += a * math.sin(theta)

    theta += radians(-b)



print(int(x))

print(int(y))
import math

pi=3.14159265358979



x = 0

y = 0

theta = math.radians(90)



while True:

    a, b = list(map(float, input().split(',')))

    if a==0 and b==0: break

    x += a * math.cos(theta)

    y += a * math.sin(theta)

    theta += math.radians(-b)



print(int(x))

print(int(y))
import math

pi = 3.14159265358979


def radians(x):
    return 1.0 * x / 180 * pi


x = 0
y = 0
theta = radians(90)
while True:
    a, b = list(map(float, input().split(",")))
    if a == 0 and b == 0:
        break
    x += a * math.cos(theta)
    y += a * math.sin(theta)
    theta += radians(-b)
print(int(x))
print(int(y))

import math

pi = 3.14159265358979
x = 0
y = 0
theta = math.radians(90)
while True:
    a, b = list(map(float, input().split(",")))
    if a == 0 and b == 0:
        break
    x += a * math.cos(theta)
    y += a * math.sin(theta)
    theta += math.radians(-b)
print(int(x))
print(int(y))

- - -def radians(x): -    return 1.0 * x / 180 * pi - - -theta = radians(90) +theta = math.radians(90) -    theta += radians(-b) +    theta += math.radians(-b)