Scanf.scanf "%d" (fun a ->
    let isprime a =
        let rec loop i =
            if i * i > a then true else
                if a mod i = 0 then false else
                    loop (i + 1)
        in
        loop 2
    in
    let rec loop k =
        if isprime k then k else loop (k + 1)
    in
    loop a |> Printf.printf "%d\n"
)