# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042

import sys

sys.setrecursionlimit(1000000)



x= int(eval(input()))



def prime_check(num,count):

    if (num % count) != 0:

        if num <= count**2:

            print(num)

        else:

            prime_check(num,count+1)

    else :

        prime_check(num+1,2)



if x==2 :

    print((2))

else:

    prime_check(x,2)

# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042

x= int(eval(input()))



def prime_check(num,count):

    while True:

        while num % count == 0:

            num = num + 1

            count = 2

        if num <= count**2:

            print(num)

            break

        else:

            count = count + 1



if x==2 :

    print((2))

else:

    prime_check(x,2)

# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
import sys

sys.setrecursionlimit(1000000)
x = int(eval(input()))


def prime_check(num, count):
    if (num % count) != 0:
        if num <= count**2:
            print(num)
        else:
            prime_check(num, count + 1)
    else:
        prime_check(num + 1, 2)


if x == 2:
    print((2))
else:
    prime_check(x, 2)

# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
x = int(eval(input()))


def prime_check(num, count):
    while True:
        while num % count == 0:
            num = num + 1
            count = 2
        if num <= count**2:
            print(num)
            break
        else:
            count = count + 1


if x == 2:
    print((2))
else:
    prime_check(x, 2)

-import sys - -sys.setrecursionlimit(1000000) -    if (num % count) != 0: +    while True: +        while num % count == 0: +            num = num + 1 +            count = 2 +            break -            prime_check(num, count + 1) -    else: -        prime_check(num + 1, 2) +            count = count + 1