open Num let gcd a b = let rec gcd' a b = let rem = mod_num a b in if rem =/ Int 0 then b else gcd' b rem in gcd' (max_num a b) (min_num a b) let () = let a, b = read_line () |> Str.split (Str.regexp_string " ") |> fun lst -> (List.nth lst 0, List.nth lst 1) |> fun (a, b) -> (num_of_string a, num_of_string b) in let s = a +/ b and p = a */ b in gcd s p |> string_of_num |> print_endline