require 'matrix'
include Math

def rotate(angle)
    c = cos(PI * angle / 180)
    s = sin(PI * angle / 180)
    Matrix[
        [c, s],
        [-s,  c]
        ]
end

x = Vector[0, 0]
v = Vector[0, 1]
while gets
    step, angle = $_.split(?,).map(&:to_i)
    break if step == 0 && angle == 0
    x += v * step
    v = rotate(angle) * v
end

puts x.to_a.map(&:to_i)