s = int(eval(input()))

if s <= 2:

  print((2))

  exit()

elif s <= 3:

  print((3))

  exit()

elif s <= 5:

  print((5))

  exit()



while True:

  for i in range(2,s // 2):

    if s % i == 0:

      break

  if i == s //2 -1:

    print(s)

    exit()

  s += 1



##C

X = int(eval(input()))

##素数かどうか判定

from math import sqrt

def is_prime(n):

    for i in range(2, int(sqrt(n))):

        if n % i == 0:

            return False

    else:

        return True



while (not is_prime(X)):

    X += 1



print(X)

s = int(eval(input()))
if s <= 2:
    print((2))
    exit()
elif s <= 3:
    print((3))
    exit()
elif s <= 5:
    print((5))
    exit()
while True:
    for i in range(2, s // 2):
        if s % i == 0:
            break
    if i == s // 2 - 1:
        print(s)
        exit()
    s += 1

##C
X = int(eval(input()))
##素数かどうか判定
from math import sqrt


def is_prime(n):
    for i in range(2, int(sqrt(n))):
        if n % i == 0:
            return False
    else:
        return True


while not is_prime(X):
    X += 1
print(X)

-s = int(eval(input())) -if s <= 2: -    print((2)) -    exit() -elif s <= 3: -    print((3)) -    exit() -elif s <= 5: -    print((5)) -    exit() -while True: -    for i in range(2, s // 2): -        if s % i == 0: -            break -    if i == s // 2 - 1: -        print(s) -        exit() -    s += 1 +##C +X = int(eval(input())) +##素数かどうか判定 +from math import sqrt + + +def is_prime(n): +    for i in range(2, int(sqrt(n))): +        if n % i == 0: +            return False +    else: +        return True + + +while not is_prime(X): +    X += 1 +print(X)