X = int(eval(input()))

for i in range(X, 100005):

  for j in range(2,i):

    if i%j == 0:

      break

  else:

    print(i)

    quit()
import math

X = int(eval(input()))

def isPrime(n):

  if n == 1:

    return False

  max = math.ceil(math.sqrt(n))

  for i in range(2,max):

    if n % i == 0:

      return False

  return True



while(True):

  if isPrime(X):

    print(X)

    quit()

  else:

    X = X+1
X = int(eval(input()))
for i in range(X, 100005):
    for j in range(2, i):
        if i % j == 0:
            break
    else:
        print(i)
        quit()

import math

X = int(eval(input()))


def isPrime(n):
    if n == 1:
        return False
    max = math.ceil(math.sqrt(n))
    for i in range(2, max):
        if n % i == 0:
            return False
    return True


while True:
    if isPrime(X):
        print(X)
        quit()
    else:
        X = X + 1

+import math + -for i in range(X, 100005): -    for j in range(2, i): -        if i % j == 0: -            break + + +def isPrime(n): +    if n == 1: +        return False +    max = math.ceil(math.sqrt(n)) +    for i in range(2, max): +        if n % i == 0: +            return False +    return True + + +while True: +    if isPrime(X): +        print(X) +        quit() -        print(i) -        quit() +        X = X + 1