x = int(eval(input()))

n = 2

while n<x:

    if x%n == 0:

        x+=1

        n=2

    else:

        n+=1

print(x)
x = int(eval(input()))

for y in range(x,2*x):

    for i in range(2, int(y**.5)+1):

        if y%i ==0:

            break

    else:

        print(y)

        break
x = int(eval(input()))
n = 2
while n < x:
    if x % n == 0:
        x += 1
        n = 2
    else:
        n += 1
print(x)

x = int(eval(input()))
for y in range(x, 2 * x):
    for i in range(2, int(y**0.5) + 1):
        if y % i == 0:
            break
    else:
        print(y)
        break

-n = 2 -while n < x: -    if x % n == 0: -        x += 1 -        n = 2 +for y in range(x, 2 * x): +    for i in range(2, int(y**0.5) + 1): +        if y % i == 0: +            break -        n += 1 -print(x) +        print(y) +        break