import math

import bisect

def eratosthenes(limit):

    A = [i for i in range(2, limit+1)]

    P = []

    time = 0

    

    while True:

        prime = min(A)

        

        if prime > math.sqrt(limit):

            break

            

        P.append(prime)

            

        i = 0

        while i < len(A):

            if A[i] % prime == 0:

                A.pop(i)

                continue

            i += 1

            

    for a in A:

        P.append(a)

            

    return P

n = int(eval(input()))

P = eratosthenes(100100)

insert_index = bisect.bisect_left(P,n)

print((P[insert_index]))
n = int(eval(input()))

while True:

    Flag = True

    for i in range(2,n):

        if n % i == 0:

            Flag = False

            break

    if Flag:

        print(n)

        exit()

    n += 1
import math
import bisect


def eratosthenes(limit):
    A = [i for i in range(2, limit + 1)]
    P = []
    time = 0
    while True:
        prime = min(A)
        if prime > math.sqrt(limit):
            break
        P.append(prime)
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        P.append(a)
    return P


n = int(eval(input()))
P = eratosthenes(100100)
insert_index = bisect.bisect_left(P, n)
print((P[insert_index]))

n = int(eval(input()))
while True:
    Flag = True
    for i in range(2, n):
        if n % i == 0:
            Flag = False
            break
    if Flag:
        print(n)
        exit()
    n += 1

-import math -import bisect - - -def eratosthenes(limit): -    A = [i for i in range(2, limit + 1)] -    P = [] -    time = 0 -    while True: -        prime = min(A) -        if prime > math.sqrt(limit): +n = int(eval(input())) +while True: +    Flag = True +    for i in range(2, n): +        if n % i == 0: +            Flag = False -        P.append(prime) -        i = 0 -        while i < len(A): -            if A[i] % prime == 0: -                A.pop(i) -                continue -            i += 1 -    for a in A: -        P.append(a) -    return P - - -n = int(eval(input())) -P = eratosthenes(100100) -insert_index = bisect.bisect_left(P, n) -print((P[insert_index])) +    if Flag: +        print(n) +        exit() +    n += 1