open Printf
open Scanf

let is_prime n =
  let rec loop i =
    if i * i > n then true
    else if n mod i = 0 then false
    else loop (i + 1) in
  if n = 1 then false else loop 2

let solve n =
  let rec loop i =
    if is_prime i then i
    else loop (i + 1) in
  loop n

let () =
  scanf "%d " solve |> printf "%d\n"
