from math import sqrt



N = 10 ** 6

p = [True] * (N + 1)

p[0] = False

p[1] = False

n = int(sqrt(N) + 1)



for i in range(4, N+1, 2):

  p[i] = False

for j in range(3, n+1, 2):

  if p[j]:

    for k in range(j+j, N+1, j):

      p[k] = False



x = int(eval(input()))

for l in range(x, N+1):

  if p[l]:

    print(l)

    break
import math

x = int(eval(input()))



a = 10 ** 6

b = int(math.sqrt(a)+1)

p = [True]*(a+1)

p[0] = False

p[1] = False



for i in range(4, a+1, 2):

  p[i] = False

  

for i in range(3, b+1, 2):

  if p[i]:

    for j in range(i+i, a+1, i):

      p[j] = False



for i in range(x, a+1):

  if p[i]:

    print(i)

    break
from math import sqrt

N = 10**6
p = [True] * (N + 1)
p[0] = False
p[1] = False
n = int(sqrt(N) + 1)
for i in range(4, N + 1, 2):
    p[i] = False
for j in range(3, n + 1, 2):
    if p[j]:
        for k in range(j + j, N + 1, j):
            p[k] = False
x = int(eval(input()))
for l in range(x, N + 1):
    if p[l]:
        print(l)
        break

import math

x = int(eval(input()))
a = 10**6
b = int(math.sqrt(a) + 1)
p = [True] * (a + 1)
p[0] = False
p[1] = False
for i in range(4, a + 1, 2):
    p[i] = False
for i in range(3, b + 1, 2):
    if p[i]:
        for j in range(i + i, a + 1, i):
            p[j] = False
for i in range(x, a + 1):
    if p[i]:
        print(i)
        break

-from math import sqrt +import math -N = 10**6 -p = [True] * (N + 1) +x = int(eval(input())) +a = 10**6 +b = int(math.sqrt(a) + 1) +p = [True] * (a + 1) -n = int(sqrt(N) + 1) -for i in range(4, N + 1, 2): +for i in range(4, a + 1, 2): -for j in range(3, n + 1, 2): -    if p[j]: -        for k in range(j + j, N + 1, j): -            p[k] = False -x = int(eval(input())) -for l in range(x, N + 1): -    if p[l]: -        print(l) +for i in range(3, b + 1, 2): +    if p[i]: +        for j in range(i + i, a + 1, i): +            p[j] = False +for i in range(x, a + 1): +    if p[i]: +        print(i)