a = int(eval(input()))

flag = 0

j = 0

while(flag != 1):

    count =0

    temp = a+j

    for i in range(2, temp):

        if(temp %i == 0):

            count +=1

    if(count == 0):

        flag =1

        print(temp)

    j+=1
import math 



def isPrime(n): 



    if(n <= 1): 

        return False

    if(n <= 3): 

        return True



    if(n % 2 == 0 or n % 3 == 0): 

        return False

      

    for i in range(5,int(math.sqrt(n) + 1), 6):  

        if(n % i == 0 or n % (i + 2) == 0): 

            return False

      

    return True

  

def nextPrime(N): 



    if (N <= 1): 

        return 2

  

    prime = N 

    found = False



    while(not found): 

        prime = prime + 1

  

        if(isPrime(prime) == True): 

            found = True

  

    return prime 



N = int(eval(input()))

print((nextPrime(N-1))) 
a = int(eval(input()))
flag = 0
j = 0
while flag != 1:
    count = 0
    temp = a + j
    for i in range(2, temp):
        if temp % i == 0:
            count += 1
    if count == 0:
        flag = 1
        print(temp)
    j += 1

import math


def isPrime(n):
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    for i in range(5, int(math.sqrt(n) + 1), 6):
        if n % i == 0 or n % (i + 2) == 0:
            return False
    return True


def nextPrime(N):
    if N <= 1:
        return 2
    prime = N
    found = False
    while not found:
        prime = prime + 1
        if isPrime(prime) == True:
            found = True
    return prime


N = int(eval(input()))
print((nextPrime(N - 1)))

-a = int(eval(input())) -flag = 0 -j = 0 -while flag != 1: -    count = 0 -    temp = a + j -    for i in range(2, temp): -        if temp % i == 0: -            count += 1 -    if count == 0: -        flag = 1 -        print(temp) -    j += 1 +import math + + +def isPrime(n): +    if n <= 1: +        return False +    if n <= 3: +        return True +    if n % 2 == 0 or n % 3 == 0: +        return False +    for i in range(5, int(math.sqrt(n) + 1), 6): +        if n % i == 0 or n % (i + 2) == 0: +            return False +    return True + + +def nextPrime(N): +    if N <= 1: +        return 2 +    prime = N +    found = False +    while not found: +        prime = prime + 1 +        if isPrime(prime) == True: +            found = True +    return prime + + +N = int(eval(input())) +print((nextPrime(N - 1)))