from bisect import bisect_left





def get_primes(n):

    prime = []

    limit = n ** 0.5

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

    while True:

        p = data[0]

        if limit <= p:

            return prime + data

        prime.append(p)

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





X = int(eval(input()))

primes = get_primes(10 ** 5 + 3)

print((primes[bisect_left(primes, X)]))

X = int(eval(input()))

while any(X % i == 0 for i in range(2, int(X ** 0.5) + 1)):

    X += 1

print(X)
from bisect import bisect_left


def get_primes(n):
    prime = []
    limit = n**0.5
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


X = int(eval(input()))
primes = get_primes(10**5 + 3)
print((primes[bisect_left(primes, X)]))

X = int(eval(input()))
while any(X % i == 0 for i in range(2, int(X**0.5) + 1)):
    X += 1
print(X)

-from bisect import bisect_left - - -def get_primes(n): -    prime = [] -    limit = n**0.5 -    data = [i + 1 for i in range(1, n)] -    while True: -        p = data[0] -        if limit <= p: -            return prime + data -        prime.append(p) -        data = [e for e in data if e % p != 0] - - -primes = get_primes(10**5 + 3) -print((primes[bisect_left(primes, X)])) +while any(X % i == 0 for i in range(2, int(X**0.5) + 1)): +    X += 1 +print(X)