from bisect import bisect_left

INFTY = 10**5+10

P = [1 for _ in range(INFTY)]

P[0]=0

P[1]=0

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

    for j in range(i*i,INFTY,i):

        P[j] = 0

Q = []

for i in range(INFTY):

    if P[i]==1:

        Q.append(i)

X = int(eval(input()))

ind = bisect_left(Q,X)

print((Q[ind]))
P = [1 for _ in range(10**6)]

P[0]=0

P[1]=0

for i in range(2,10**3+1):

    for j in range(i*i,10**6,i):

        P[j]=0

X = int(eval(input()))

for i in range(X,10**6):

    if P[i]==1:

        print(i)

        break
from bisect import bisect_left

INFTY = 10**5 + 10
P = [1 for _ in range(INFTY)]
P[0] = 0
P[1] = 0
for i in range(2, int(INFTY**0.5) + 1):
    for j in range(i * i, INFTY, i):
        P[j] = 0
Q = []
for i in range(INFTY):
    if P[i] == 1:
        Q.append(i)
X = int(eval(input()))
ind = bisect_left(Q, X)
print((Q[ind]))

P = [1 for _ in range(10**6)]
P[0] = 0
P[1] = 0
for i in range(2, 10**3 + 1):
    for j in range(i * i, 10**6, i):
        P[j] = 0
X = int(eval(input()))
for i in range(X, 10**6):
    if P[i] == 1:
        print(i)
        break

-from bisect import bisect_left - -INFTY = 10**5 + 10 -P = [1 for _ in range(INFTY)] +P = [1 for _ in range(10**6)] -for i in range(2, int(INFTY**0.5) + 1): -    for j in range(i * i, INFTY, i): +for i in range(2, 10**3 + 1): +    for j in range(i * i, 10**6, i): -Q = [] -for i in range(INFTY): +X = int(eval(input())) +for i in range(X, 10**6): -        Q.append(i) -X = int(eval(input())) -ind = bisect_left(Q, X) -print((Q[ind])) +        print(i) +        break