let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> List.rev (s :: acc)
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  doit str []

let gcd m n =
  let rec doit x y =
    if y <= 0 then x else doit y (x mod y)
  in
  if m > n then doit m n else doit n m

let () =
  match List.map int_of_string (split (read_line ()) ' ') with
  | [] | [_] -> exit 1
  | a :: b :: _ -> Printf.printf "%d\n" (gcd a b)