datas = []

while data = gets
  datas << data.split(",").map(&:to_i)
end

x = 0
y = 0
prev_rad = 90 * Math::PI / 180.0

datas.each do |data|
  x += data[0] * Math.cos(prev_rad)
  y += data[0] * Math.sin(prev_rad)
  prev_rad -= data[1] * Math::PI / 180.0
end

puts x.to_i
puts y.to_i