X=int(eval(input()))



f=False

a=X

if X==2:

    print("2")

    exit()

while f==False:

    for i in range(2,a+1):

        if a%i==0:

            break

        if i==a-1:

            f=True

    a+=1

print((a-1))





X=int(eval(input()))



f=False

a=X

if X==2 or X==3:

    print(X)

    exit()

while f==False:

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

        if a%i==0:

            break

        if i==int(a**0.5):

            f=True

    a+=1

print((a-1))
X = int(eval(input()))
f = False
a = X
if X == 2:
    print("2")
    exit()
while f == False:
    for i in range(2, a + 1):
        if a % i == 0:
            break
        if i == a - 1:
            f = True
    a += 1
print((a - 1))

X = int(eval(input()))
f = False
a = X
if X == 2 or X == 3:
    print(X)
    exit()
while f == False:
    for i in range(2, int(a**0.5) + 1):
        if a % i == 0:
            break
        if i == int(a**0.5):
            f = True
    a += 1
print((a - 1))

-if X == 2: -    print("2") +if X == 2 or X == 3: +    print(X) -    for i in range(2, a + 1): +    for i in range(2, int(a**0.5) + 1): -        if i == a - 1: +        if i == int(a**0.5):