X=int(eval(input()))

num=2

while num<X:

    if X%num==0:

        X+=1

        num=2

    else:

        num+=1

print(X)
X=int(eval(input()))

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

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

        if x%i==0:

            break

    else:

        print(x)

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

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

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