a = gets.strip.to_i
def judge(a)
  if a == 2
    return true
  end
  if a== 1
    return true
  end
  Array(2..(a-1)).each do |num|
    if a%num == 0
     return false
    end
  end
  return true
end


while true do
  if judge(a)
    break
  end
  a+=1
end
puts a
