x = 0
y = 0
d = 90

while true
    a,b=gets.split(",").map(&:to_i)
    if a==0 and b==0
        break    
    end
    
    rad = d/180.0*Math::PI
    x += a*Math.cos(rad)
    y += a*Math.sin(rad)
    d -= b
    puts "#{x},#{y},#{rad}"
end

puts [x,y].map(&:to_i).join("\n")