function isprime(x::Int64)
    if x<=1
        return false
    end
    rootx = ceil(Int64, sqrt(x))
    for i =2:rootx
        if x%i==0
            return false
        end
    end
    return true
end

x1 = parse(Int64, readline())
# println(x1)
p = x1
# println(p)

while (!isprime(p))
    global p += 1
end
println(p)
