import math

X = int(eval(input()))

if X == 2:

    print((2))

else:

    is_find = False

    while not is_find:

        for i in range(2, X//2):

            is_find = True

            if math.gcd(X, i) != 1:

                is_find = False

                X += 1

                break

        rst = X

    print(rst)
import math

X = int(eval(input()))

if X == 2:

    print((2))

else:

    is_end = False

    while not is_end:

        is_end = True

        for i in range(1, X // 2):

            if math.gcd(X, i) != 1:

                is_end = False

                X += 1

                break

    print(X)
import math

X = int(eval(input()))
if X == 2:
    print((2))
else:
    is_find = False
    while not is_find:
        for i in range(2, X // 2):
            is_find = True
            if math.gcd(X, i) != 1:
                is_find = False
                X += 1
                break
        rst = X
    print(rst)

import math

X = int(eval(input()))
if X == 2:
    print((2))
else:
    is_end = False
    while not is_end:
        is_end = True
        for i in range(1, X // 2):
            if math.gcd(X, i) != 1:
                is_end = False
                X += 1
                break
    print(X)

-    is_find = False -    while not is_find: -        for i in range(2, X // 2): -            is_find = True +    is_end = False +    while not is_end: +        is_end = True +        for i in range(1, X // 2): -                is_find = False +                is_end = False -        rst = X -    print(rst) +    print(X)