import sys, re, os

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from fractions import gcd

 

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def S_MAP(): return list(map(str, input().split()))

def LIST(): return list(map(int, input().split()))

def S_LIST(): return list(map(str, input().split()))

 

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



# 最小公倍数

def gcd(a, b):

	if a < b:

		a, b = b, a

	while a % b != 0:

		a, b = b, a % b

	return b

 

# 最大公約数 

def lcm(a, b):

	y = a*b / gcd(a, b)

	return int(y)



def primes_for(n):

  is_prime = [True] * (n + 1)

  is_prime[0] = False

  is_prime[1] = False

  for i in range(2, n + 1):

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

          is_prime[j] = False

  return [i for i in range(n + 1) if is_prime[i]]



# O(√A)

def isPrime(n):

  if n < 2:

    # 2未満は素数でない

    return False

  if n == 2:

    # 2は素数

    return True

  for p in range(2, n):

      if n % p == 0:

        # nまでの数で割り切れたら素数ではない

        return False

  # nまでの数で割り切れなかったら素数

  return True



x = INT()



while isPrime(x) == False:

  x = x + 1

print(x)
import sys, re, os

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from fractions import gcd

from bisect import bisect, bisect_left, bisect_right



def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def S_MAP(): return list(map(str, input().split()))

def LIST(): return list(map(int, input().split()))

def S_LIST(): return list(map(str, input().split()))

 

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



N = INT()



def sieve(n):

    is_prime = [True for _ in range(n+1)]

    is_prime[0] = False



    for i in range(2, n+1):

        if is_prime[i-1]:

            j = 2 * i

            while j <= n:

                is_prime[j-1] = False

                j += i

    table = [ i for i in range(1, n+1) if is_prime[i-1]]

    return table







def is_prime(n):

    for i in range(2, n + 1):

        if i * i > n:

            break

        if n % i == 0:

            return False

    return n != 1



while 1:

    if is_prime(N) == True:

        print(N)

        exit()

    else:

        N += 1

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def S_MAP():
    return list(map(str, input().split()))


def LIST():
    return list(map(int, input().split()))


def S_LIST():
    return list(map(str, input().split()))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
# 最小公倍数
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


# 最大公約数
def lcm(a, b):
    y = a * b / gcd(a, b)
    return int(y)


def primes_for(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


# O(√A)
def isPrime(n):
    if n < 2:
        # 2未満は素数でない
        return False
    if n == 2:
        # 2は素数
        return True
    for p in range(2, n):
        if n % p == 0:
            # nまでの数で割り切れたら素数ではない
            return False
    # nまでの数で割り切れなかったら素数
    return True


x = INT()
while isPrime(x) == False:
    x = x + 1
print(x)

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def S_MAP():
    return list(map(str, input().split()))


def LIST():
    return list(map(int, input().split()))


def S_LIST():
    return list(map(str, input().split()))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
N = INT()


def sieve(n):
    is_prime = [True for _ in range(n + 1)]
    is_prime[0] = False
    for i in range(2, n + 1):
        if is_prime[i - 1]:
            j = 2 * i
            while j <= n:
                is_prime[j - 1] = False
                j += i
    table = [i for i in range(1, n + 1) if is_prime[i - 1]]
    return table


def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


while 1:
    if is_prime(N) == True:
        print(N)
        exit()
    else:
        N += 1

+from bisect import bisect, bisect_left, bisect_right -# 最小公倍数 -def gcd(a, b): -    if a < b: -        a, b = b, a -    while a % b != 0: -        a, b = b, a % b -    return b +N = INT() -# 最大公約数 -def lcm(a, b): -    y = a * b / gcd(a, b) -    return int(y) +def sieve(n): +    is_prime = [True for _ in range(n + 1)] +    is_prime[0] = False +    for i in range(2, n + 1): +        if is_prime[i - 1]: +            j = 2 * i +            while j <= n: +                is_prime[j - 1] = False +                j += i +    table = [i for i in range(1, n + 1) if is_prime[i - 1]] +    return table -def primes_for(n): -    is_prime = [True] * (n + 1) -    is_prime[0] = False -    is_prime[1] = False +def is_prime(n): -        for j in range(i * 2, n + 1, i): -            is_prime[j] = False -    return [i for i in range(n + 1) if is_prime[i]] +        if i * i > n: +            break +        if n % i == 0: +            return False +    return n != 1 -# O(√A) -def isPrime(n): -    if n < 2: -        # 2未満は素数でない -        return False -    if n == 2: -        # 2は素数 -        return True -    for p in range(2, n): -        if n % p == 0: -            # nまでの数で割り切れたら素数ではない -            return False -    # nまでの数で割り切れなかったら素数 -    return True - - -x = INT() -while isPrime(x) == False: -    x = x + 1 -print(x) +while 1: +    if is_prime(N) == True: +        print(N) +        exit() +    else: +        N += 1