pos = [0,0]
deg = 90
until (n = gets.chomp.split(',').map(&:to_i)) == [0,0]
    pos[0] = pos[0] + Math.sin(Math::PI*deg/180) * n[0]
    pos[1] = pos[1] + Math.cos(Math::PI*deg/180) * n[0]

    deg -= n[1]
end

puts pos[1].to_i, pos[0].to_i