X = int(eval(input()))



memo = [None]*(2*X)



for i,v in enumerate(memo):

    if i < 2:

        continue

    if v is None:

        memo[i] = True

        for j in range(i*2, 2*X, i):

            memo[j] = False



print((next(i+X for i,v in enumerate(memo[X:]) if v)))


# 素因数分解

def prime_factors(n):

    i = 2

    while i * i <= n:

        if n % i:

            i += 1

        else:

            n //= i

            yield i

    if n > 1:

        yield n



from itertools import count



X = int(eval(input()))



for x in count(X):

    if len(tuple(prime_factors(x))) == 1:

        print(x)

        break
X = int(eval(input()))
memo = [None] * (2 * X)
for i, v in enumerate(memo):
    if i < 2:
        continue
    if v is None:
        memo[i] = True
        for j in range(i * 2, 2 * X, i):
            memo[j] = False
print((next(i + X for i, v in enumerate(memo[X:]) if v)))

# 素因数分解
def prime_factors(n):
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            yield i
    if n > 1:
        yield n


from itertools import count

X = int(eval(input()))
for x in count(X):
    if len(tuple(prime_factors(x))) == 1:
        print(x)
        break

+# 素因数分解 +def prime_factors(n): +    i = 2 +    while i * i <= n: +        if n % i: +            i += 1 +        else: +            n //= i +            yield i +    if n > 1: +        yield n + + +from itertools import count + -memo = [None] * (2 * X) -for i, v in enumerate(memo): -    if i < 2: -        continue -    if v is None: -        memo[i] = True -        for j in range(i * 2, 2 * X, i): -            memo[j] = False -print((next(i + X for i, v in enumerate(memo[X:]) if v))) +for x in count(X): +    if len(tuple(prime_factors(x))) == 1: +        print(x) +        break