import math

import sys

x = int(eval(input()))

flg = 0



if x == 2:

  print(x)

  sys.exit()



for i in range(x,100005):

  flg = 0

  for j in range(2,int(math.sqrt(i))+1):

    if i%j == 0:

      flg = 1

    if flg == 0 and j == int(math.sqrt(i)):

      print(i)

      sys.exit()

    continue

      
import sys

import math

x=int(eval(input()))



while True:

  for i in range(2,int(math.sqrt(x))):

    if x%i==0:

      break

  else:

    print(x)

    break

  x+=1
import math
import sys

x = int(eval(input()))
flg = 0
if x == 2:
    print(x)
    sys.exit()
for i in range(x, 100005):
    flg = 0
    for j in range(2, int(math.sqrt(i)) + 1):
        if i % j == 0:
            flg = 1
        if flg == 0 and j == int(math.sqrt(i)):
            print(i)
            sys.exit()
        continue

import sys
import math

x = int(eval(input()))
while True:
    for i in range(2, int(math.sqrt(x))):
        if x % i == 0:
            break
    else:
        print(x)
        break
    x += 1

+import sys -import sys -flg = 0 -if x == 2: -    print(x) -    sys.exit() -for i in range(x, 100005): -    flg = 0 -    for j in range(2, int(math.sqrt(i)) + 1): -        if i % j == 0: -            flg = 1 -        if flg == 0 and j == int(math.sqrt(i)): -            print(i) -            sys.exit() -        continue +while True: +    for i in range(2, int(math.sqrt(x))): +        if x % i == 0: +            break +    else: +        print(x) +        break +    x += 1