X = int(eval(input()))



count = 0



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

    if X % i == 0:

        count += 1

    

if count == 1:

    print(X)

else:

    while True:

        count = 0

        X += 1

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

            if X % i == 0:

                count += 1

        if count == 1:

            print(X)

            break
x = int(eval(input()))

p = x - 1

prime = False



if x == 2:

    print((2))

else:

    while prime == False:

        p += 1

        prime = True

        

        for i in range(2, p - 1):

            if p % i == 0:

                prime = False

                break

            

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

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

-X = int(eval(input())) -count = 0 -for i in range(2, X + 1, 1): -    if X % i == 0: -        count += 1 -if count == 1: -    print(X) +x = int(eval(input())) +p = x - 1 +prime = False +if x == 2: +    print((2)) -    while True: -        count = 0 -        X += 1 -        for i in range(2, X + 1, 1): -            if X % i == 0: -                count += 1 -        if count == 1: -            print(X) -            break +    while prime == False: +        p += 1 +        prime = True +        for i in range(2, p - 1): +            if p % i == 0: +                prime = False +                break +    print(p)