def deg2rad r
  r * Math::PI / 180
end

x = 0.0
y = 0.0
r = 90
loop do
  d, a = gets.split(?,).map(&:to_i)
  break if d==0 and a==0
  x += d * Math.cos(deg2rad(r))
  y += d * Math.sin(deg2rad(r))
  r -= a
end
puts [x,y].map(&:to_i)