let rec gcd a b = match a mod b with
    0 -> b
  | d -> gcd b d ;;

let () =
  let a, b = Scanf.scanf "%d %d\n" (fun x y -> if x > y then x, y else y, x) in
  print_int (gcd a b); print_newline() ;;
