import sys

def input():

    return sys.stdin.readline()[:-1]

x=int(eval(input()))

while 1:

    flag=0

    for i in range(2,int(x**(1/2))):

        if x%i==0:

            flag=1

            break

    if flag==0:

        break

    x+=1

print(x)
import bisect, copy, heapq, math, sys

from collections import *

from functools import lru_cache

from itertools import accumulate, combinations, permutations, product

def input():

    return sys.stdin.readline()[:-1]

def ruiseki(lst):

    return [0]+list(accumulate(lst))

def celi(a,b):

    return -(-a//b)

sys.setrecursionlimit(5000000)

mod=pow(10,9)+7

al=[chr(ord('a') + i) for i in range(26)]

direction=[[1,0],[0,1],[-1,0],[0,-1]]



x=int(eval(input()))

def is_prime(n):

    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):

        if n % k == 0:

            return False

    return True



ans=x

while not is_prime(ans):

    ans+=1

print(ans)
import sys


def input():
    return sys.stdin.readline()[:-1]


x = int(eval(input()))
while 1:
    flag = 0
    for i in range(2, int(x ** (1 / 2))):
        if x % i == 0:
            flag = 1
            break
    if flag == 0:
        break
    x += 1
print(x)

import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product


def input():
    return sys.stdin.readline()[:-1]


def ruiseki(lst):
    return [0] + list(accumulate(lst))


def celi(a, b):
    return -(-a // b)


sys.setrecursionlimit(5000000)
mod = pow(10, 9) + 7
al = [chr(ord("a") + i) for i in range(26)]
direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
x = int(eval(input()))


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


ans = x
while not is_prime(ans):
    ans += 1
print(ans)

-import sys +import bisect, copy, heapq, math, sys +from collections import * +from functools import lru_cache +from itertools import accumulate, combinations, permutations, product +def ruiseki(lst): +    return [0] + list(accumulate(lst)) + + +def celi(a, b): +    return -(-a // b) + + +sys.setrecursionlimit(5000000) +mod = pow(10, 9) + 7 +al = [chr(ord("a") + i) for i in range(26)] +direction = [[1, 0], [0, 1], [-1, 0], [0, -1]] -while 1: -    flag = 0 -    for i in range(2, int(x ** (1 / 2))): -        if x % i == 0: -            flag = 1 -            break -    if flag == 0: -        break -    x += 1 -print(x) + + +def is_prime(n): +    if n == 1: +        return False +    for k in range(2, int(math.sqrt(n)) + 1): +        if n % k == 0: +            return False +    return True + + +ans = x +while not is_prime(ans): +    ans += 1 +print(ans)