p=0
q=0
t=0
while line = STDIN.gets
  line.chomp!
  if line == '0,0' then break end
  x,y = line.split(',').map { |item| item.to_i }
  n = t * Math::PI / 180.0
  p += x * Math.sin(n)
  q += x * Math.cos(n)
  t += y.to_i
end

puts p.to_i
puts q.to_i