X=int(eval(input()))

flag=1

if X==2:

    flag=0

 

while(flag==1):

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

        if(X%i==0):

            X+=1

          

            break

        if(i==X-1):

       

            flag=0

            break

 

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



def prime(N):

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

    if N%i==0:

      return -1

  

  return N



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

  if prime(x)==x:

    print(x)

    break
X = int(eval(input()))
flag = 1
if X == 2:
    flag = 0
while flag == 1:
    for i in range(2, X + 1):
        if X % i == 0:
            X += 1
            break
        if i == X - 1:
            flag = 0
            break
print(X)

X = int(eval(input()))


def prime(N):
    for i in range(2, N - 1):
        if N % i == 0:
            return -1
    return N


for x in range(X, 10**10):
    if prime(x) == x:
        print(x)
        break

-flag = 1 -if X == 2: -    flag = 0 -while flag == 1: -    for i in range(2, X + 1): -        if X % i == 0: -            X += 1 -            break -        if i == X - 1: -            flag = 0 -            break -print(X) + + +def prime(N): +    for i in range(2, N - 1): +        if N % i == 0: +            return -1 +    return N + + +for x in range(X, 10**10): +    if prime(x) == x: +        print(x) +        break