

def get_sieve_of_eratosthenes(n):

    if not isinstance(n, int):

        raise TypeError('n is int type.')

    if n < 2:

        raise ValueError('n is more than 2')

    prime = [2]

    limit = int(n**0.5)

    data = [i + 1 for i in range(2, n, 2)]

    while True:

        p = data[0]

        if limit <= p:

            return prime + data

        prime.append(p)

        data = [e for e in data if e % p != 0]





def main():

    X = int(eval(input()))

    primes = get_sieve_of_eratosthenes(X*2)

    for p in primes:

        if X <= p:

            print(p)

            break





if __name__ == "__main__":

    main()



def is_prime(n):

    i = 2

    while(i**2 <= n):

        if n % i == 0:

            return False

        i += 1

    return True





def main():

    X = int(eval(input()))

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

        if is_prime(x):

            print(x)

            break





if __name__ == "__main__":

    main()

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int type.")
    if n < 2:
        raise ValueError("n is more than 2")
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


def main():
    X = int(eval(input()))
    primes = get_sieve_of_eratosthenes(X * 2)
    for p in primes:
        if X <= p:
            print(p)
            break


if __name__ == "__main__":
    main()

def is_prime(n):
    i = 2
    while i**2 <= n:
        if n % i == 0:
            return False
        i += 1
    return True


def main():
    X = int(eval(input()))
    for x in range(X, 2 * X):
        if is_prime(x):
            print(x)
            break


if __name__ == "__main__":
    main()

-def get_sieve_of_eratosthenes(n): -    if not isinstance(n, int): -        raise TypeError("n is int type.") -    if n < 2: -        raise ValueError("n is more than 2") -    prime = [2] -    limit = int(n**0.5) -    data = [i + 1 for i in range(2, n, 2)] -    while True: -        p = data[0] -        if limit <= p: -            return prime + data -        prime.append(p) -        data = [e for e in data if e % p != 0] +def is_prime(n): +    i = 2 +    while i**2 <= n: +        if n % i == 0: +            return False +        i += 1 +    return True -    primes = get_sieve_of_eratosthenes(X * 2) -    for p in primes: -        if X <= p: -            print(p) +    for x in range(X, 2 * X): +        if is_prime(x): +            print(x)