x = int(eval(input()))

while True:

    n = 0

    for i in range(2, x):

        if x % i == 0:

            n += 1

    if n != 0:

        x += 1

    else:

        break

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

while True:

    judge = False

    for i in range(2, x):

        if x % i == 0:

            judge = True

            break

    if judge:

        x += 1

    else:

        break

print(x)
x = int(eval(input()))
while True:
    n = 0
    for i in range(2, x):
        if x % i == 0:
            n += 1
    if n != 0:
        x += 1
    else:
        break
print(x)

x = int(eval(input()))
while True:
    judge = False
    for i in range(2, x):
        if x % i == 0:
            judge = True
            break
    if judge:
        x += 1
    else:
        break
print(x)

-    n = 0 +    judge = False -            n += 1 -    if n != 0: +            judge = True +            break +    if judge: