let () =
  let rec doit (x, y) r =
    match Scanf.scanf "%f,%f\n" (fun d t -> d, t) with
    | (0., 0.) -> Printf.printf "%d\n%d\n" (truncate x) (truncate y)
    | (d, t) -> let z = 3.141 *. r /. 180. in doit (x +. d *. cos z, y +. d *. sin z) (r -. t)
  in
  doit (0., 0.) 90.