import numpy as np



def judge_prime(num):

    FLAG = True

    

    for i in range(2, int(num**.5)+1):



        if (num%i == 0):

            FLAG = False

    

    if (num == 2):

        FLAG = True

    

    return(FLAG)



X = int(eval(input()))



while (True):

    flag = judge_prime(X)

    

    if (flag):

        break

    

    X += 1



print(X)

def judge_prime(num):

    FLAG = True

    

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



        if (num%i == 0):

            FLAG = False

    

    if (num == 2):

        FLAG = True

    

    return(FLAG)



X = int(eval(input()))



while (True):

    flag = judge_prime(X)

    

    if (flag):

        break

    

    X += 1



print(X)

import numpy as np


def judge_prime(num):
    FLAG = True
    for i in range(2, int(num**0.5) + 1):
        if num % i == 0:
            FLAG = False
    if num == 2:
        FLAG = True
    return FLAG


X = int(eval(input()))
while True:
    flag = judge_prime(X)
    if flag:
        break
    X += 1
print(X)

def judge_prime(num):
    FLAG = True
    for i in range(2, int(num**0.5) + 1):
        if num % i == 0:
            FLAG = False
    if num == 2:
        FLAG = True
    return FLAG


X = int(eval(input()))
while True:
    flag = judge_prime(X)
    if flag:
        break
    X += 1
print(X)

-import numpy as np - -