include Math

x = y = 0
degree = 90

$<.each_line do |line|
	d, t = line.split(',').map(&:to_i)
	break if d.zero? and t.zero?

	radian = degree * PI / 180
	x += d * cos(radian)
	y += d * sin(radian)

	degree -= t
end

p x.to_i
p y.to_i