def get_primes(x):

    if x < 2:

        return list()

    primes = [2]

    n = 3

    while n <= x:

        is_prime = True

        for p in primes:

            if n % p == 0:

                is_prime = False

                break

            if p**2 > n:

                break

        if is_prime:

            primes.append(n)

        n += 2

    return primes





def main():

    X = int(eval(input()))

    if X <= 1:

        print((2))

        exit(0)

    primes = get_primes(X)

    while True:

        is_prime = True

        for p in primes:

            if X % p == 0 and X > p:

                is_prime = False

                break

        if is_prime:

            break

        X += 1

    print(X)





if __name__ == '__main__':

    main()

def is_prime(x):

    if x <= 1:

        return False

    elif x == 2:

        return True

    else:

        n = 2

        while n**2 <= x:

            if x % n == 0:

                return False

            n += 1

        return True





def main():

    X = int(eval(input()))

    while True:

        if is_prime(X):

            print(X)

            break

        X += 1





if __name__ == '__main__':

    main()
def get_primes(x):
    if x < 2:
        return list()
    primes = [2]
    n = 3
    while n <= x:
        is_prime = True
        for p in primes:
            if n % p == 0:
                is_prime = False
                break
            if p**2 > n:
                break
        if is_prime:
            primes.append(n)
        n += 2
    return primes


def main():
    X = int(eval(input()))
    if X <= 1:
        print((2))
        exit(0)
    primes = get_primes(X)
    while True:
        is_prime = True
        for p in primes:
            if X % p == 0 and X > p:
                is_prime = False
                break
        if is_prime:
            break
        X += 1
    print(X)


if __name__ == "__main__":
    main()

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


def main():
    X = int(eval(input()))
    while True:
        if is_prime(X):
            print(X)
            break
        X += 1


if __name__ == "__main__":
    main()

-def get_primes(x): -    if x < 2: -        return list() -    primes = [2] -    n = 3 -    while n <= x: -        is_prime = True -        for p in primes: -            if n % p == 0: -                is_prime = False -                break -            if p**2 > n: -                break -        if is_prime: -            primes.append(n) -        n += 2 -    return primes +def is_prime(x): +    if x <= 1: +        return False +    elif x == 2: +        return True +    else: +        n = 2 +        while n**2 <= x: +            if x % n == 0: +                return False +            n += 1 +        return True -    if X <= 1: -        print((2)) -        exit(0) -    primes = get_primes(X) -        is_prime = True -        for p in primes: -            if X % p == 0 and X > p: -                is_prime = False -                break -        if is_prime: +        if is_prime(X): +            print(X) -    print(X)