import math

X = int(eval(input()))





def get_primenumber(number):

    prime_list = []

    # 2からnumberまでの数字をsearch_listに入れる

    search_list = list(range(2, number+1))

    while True:

    # search_listの先頭の値が√nの値を超えたら処理終了

        if search_list[0] > math.sqrt(number):

            # prime_listにsearch_listを結合

            prime_list.extend(search_list)

            break

        else:

            # search_listの先頭をprime_listに入れる

            head_num = search_list[0]

            prime_list.append(head_num)

            # search_listの先頭をpopする

            search_list.pop(0)

            # head_numの倍数を取り除く

            search_list = [num for num in search_list if num % head_num != 0]

    return prime_list



prime_list = get_primenumber(100000)



left = 0

right = len(prime_list)-1



if X == 2:

    print((int(2)))

elif X > 99991:

    print((int(100003)))

else:

    while left <= right:

        mid = (left+right) // 2

        if prime_list[mid] == X:

            ans = prime_list[mid]

            break

        elif prime_list[mid] > X:

            if prime_list[mid-1] < X:

                ans = prime_list[mid]

                break

            else:

                right = mid - 1

        else:

            if prime_list[mid+1] > X:

                ans = prime_list[mid+1]

                break

            else:

                left = mid + 1



    print((int(ans)))
x = int(eval(input()))



while True:

    i = 2

    ok = True

    while i * i <= x:

        if x % i == 0:

            ok = False

            break

        i += 1

    if ok:

        print(x)

        break

    x += 1
import math

X = int(eval(input()))


def get_primenumber(number):
    prime_list = []
    # 2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2, number + 1))
    while True:
        # search_listの先頭の値が√nの値を超えたら処理終了
        if search_list[0] > math.sqrt(number):
            # prime_listにsearch_listを結合
            prime_list.extend(search_list)
            break
        else:
            # search_listの先頭をprime_listに入れる
            head_num = search_list[0]
            prime_list.append(head_num)
            # search_listの先頭をpopする
            search_list.pop(0)
            # head_numの倍数を取り除く
            search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


prime_list = get_primenumber(100000)
left = 0
right = len(prime_list) - 1
if X == 2:
    print((int(2)))
elif X > 99991:
    print((int(100003)))
else:
    while left <= right:
        mid = (left + right) // 2
        if prime_list[mid] == X:
            ans = prime_list[mid]
            break
        elif prime_list[mid] > X:
            if prime_list[mid - 1] < X:
                ans = prime_list[mid]
                break
            else:
                right = mid - 1
        else:
            if prime_list[mid + 1] > X:
                ans = prime_list[mid + 1]
                break
            else:
                left = mid + 1
    print((int(ans)))

x = int(eval(input()))
while True:
    i = 2
    ok = True
    while i * i <= x:
        if x % i == 0:
            ok = False
            break
        i += 1
    if ok:
        print(x)
        break
    x += 1

-import math - -X = int(eval(input())) - - -def get_primenumber(number): -    prime_list = [] -    # 2からnumberまでの数字をsearch_listに入れる -    search_list = list(range(2, number + 1)) -    while True: -        # search_listの先頭の値が√nの値を超えたら処理終了 -        if search_list[0] > math.sqrt(number): -            # prime_listにsearch_listを結合 -            prime_list.extend(search_list) +x = int(eval(input())) +while True: +    i = 2 +    ok = True +    while i * i <= x: +        if x % i == 0: +            ok = False -        else: -            # search_listの先頭をprime_listに入れる -            head_num = search_list[0] -            prime_list.append(head_num) -            # search_listの先頭をpopする -            search_list.pop(0) -            # head_numの倍数を取り除く -            search_list = [num for num in search_list if num % head_num != 0] -    return prime_list - - -prime_list = get_primenumber(100000) -left = 0 -right = len(prime_list) - 1 -if X == 2: -    print((int(2))) -elif X > 99991: -    print((int(100003))) -else: -    while left <= right: -        mid = (left + right) // 2 -        if prime_list[mid] == X: -            ans = prime_list[mid] -            break -        elif prime_list[mid] > X: -            if prime_list[mid - 1] < X: -                ans = prime_list[mid] -                break -            else: -                right = mid - 1 -        else: -            if prime_list[mid + 1] > X: -                ans = prime_list[mid + 1] -                break -            else: -                left = mid + 1 -    print((int(ans))) +        i += 1 +    if ok: +        print(x) +        break +    x += 1