n = int(eval(input()))

const = 10**5+100



a = [i for i in range(2,const+1)]

prime = []



for i in a:

    prime.append(i)



    if i > int(n**0.5):

        break



    a = [j for j in a if j % i != 0]



prime += a



ans = [i for i in a if i >= n][0]



print(ans)
import sys



n = int(eval(input()))



while True:

    for i in range(2, int(n**0.5+1)):

        if n % i == 0:

            break

    else:

        print(n)

        sys.exit()



    n = n + 1
n = int(eval(input()))
const = 10**5 + 100
a = [i for i in range(2, const + 1)]
prime = []
for i in a:
    prime.append(i)
    if i > int(n**0.5):
        break
    a = [j for j in a if j % i != 0]
prime += a
ans = [i for i in a if i >= n][0]
print(ans)

import sys

n = int(eval(input()))
while True:
    for i in range(2, int(n**0.5 + 1)):
        if n % i == 0:
            break
    else:
        print(n)
        sys.exit()
    n = n + 1

+import sys + -const = 10**5 + 100 -a = [i for i in range(2, const + 1)] -prime = [] -for i in a: -    prime.append(i) -    if i > int(n**0.5): -        break -    a = [j for j in a if j % i != 0] -prime += a -ans = [i for i in a if i >= n][0] -print(ans) +while True: +    for i in range(2, int(n**0.5 + 1)): +        if n % i == 0: +            break +    else: +        print(n) +        sys.exit() +    n = n + 1