import numpy as np



X = int(eval(input()))



def checkprime(N):

    for i in range(2,int(np.sqrt(N))+1):

        if N%i == 0:

            return False

    return True



while True:

    if checkprime(X):

        print(X)

        exit()

    X += 1

from math import floor, sqrt



X = int(eval(input()))



def isprime(n):

    for i in range(2,floor(sqrt(n))+1):

        if n%i == 0:

            return False

    return True



while True:

    if isprime(X):

        print(X)

        exit()

    else:

        X += 1

import numpy as np

X = int(eval(input()))


def checkprime(N):
    for i in range(2, int(np.sqrt(N)) + 1):
        if N % i == 0:
            return False
    return True


while True:
    if checkprime(X):
        print(X)
        exit()
    X += 1

from math import floor, sqrt

X = int(eval(input()))


def isprime(n):
    for i in range(2, floor(sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True


while True:
    if isprime(X):
        print(X)
        exit()
    else:
        X += 1

-import numpy as np +from math import floor, sqrt -def checkprime(N): -    for i in range(2, int(np.sqrt(N)) + 1): -        if N % i == 0: +def isprime(n): +    for i in range(2, floor(sqrt(n)) + 1): +        if n % i == 0: -    if checkprime(X): +    if isprime(X): -    X += 1 +    else: +        X += 1