Scanf.scanf " %d %d %d" @@ fun a b c ->
  let rems = Array.make b false in
  let rec f n =
    let r = n mod b in
    if r = c then (print_endline "YES"; exit 0)
    else if rems.(r) then (print_endline "NO"; exit 0)
    else
      (rems.(r) <- true;
      f (n + a)) in
  f a