x = int(eval(input()))



while True:

    for i in range(2, x):

        if x % i == 0:

            break

    else:

        print(x)

        break

    x += 1

x = int(eval(input()))



while True:

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

        if x % i == 0:

            break

    else:

        print(x)

        break

    x += 1

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

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

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