include Math
x,y = 0,0
angle=90                #??????90???(PI/2rad.),??±???0?????¨??????

while buf = gets
        d,c = buf.split(',').map(&:to_f)
        break if buf.chomp=="0,0"
#p angle
        x+=(cos(angle*PI/180.0)*d)
#puts("x=#{x}")
        y+=(sin(angle*PI/180.0)*d)

        angle+=c
end

puts x.to_i*-1,y.to_i