from bisect import bisect

def main():

    maxa2 = 200000

    maxa2 = max(6, maxa2)  # maxa2が6未満だとエラーになる

    p = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(maxa2)]

    p[0] = p[1] = False

    p[2] = p[3] = p[5] = True

    for is1 in range(3, maxa2, 2):

        for is2 in range(is1 ** 2, maxa2, is1):

            p[is2] = False

    prime_list = [i for i, b in enumerate(p) if b]



    x = int(eval(input()))

    if x in prime_list:

        print(x)

    else:

        xp = bisect(prime_list, x)

        r = prime_list[xp]

        print(r)



if __name__ == '__main__':

    main()
from math import sqrt, ceil

def main():

    x = int(eval(input()))

    while True:

        for i1 in range(2, ceil(sqrt(x))):

            if x % i1 == 0:

                x += 1

                break

        else:

            break

    print(x)



if __name__ == '__main__':

    main()

from bisect import bisect


def main():
    maxa2 = 200000
    maxa2 = max(6, maxa2)  # maxa2が6未満だとエラーになる
    p = [
        False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(maxa2)
    ]
    p[0] = p[1] = False
    p[2] = p[3] = p[5] = True
    for is1 in range(3, maxa2, 2):
        for is2 in range(is1**2, maxa2, is1):
            p[is2] = False
    prime_list = [i for i, b in enumerate(p) if b]
    x = int(eval(input()))
    if x in prime_list:
        print(x)
    else:
        xp = bisect(prime_list, x)
        r = prime_list[xp]
        print(r)


if __name__ == "__main__":
    main()

from math import sqrt, ceil


def main():
    x = int(eval(input()))
    while True:
        for i1 in range(2, ceil(sqrt(x))):
            if x % i1 == 0:
                x += 1
                break
        else:
            break
    print(x)


if __name__ == "__main__":
    main()

-from bisect import bisect +from math import sqrt, ceil -    maxa2 = 200000 -    maxa2 = max(6, maxa2)  # maxa2が6未満だとエラーになる -    p = [ -        False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(maxa2) -    ] -    p[0] = p[1] = False -    p[2] = p[3] = p[5] = True -    for is1 in range(3, maxa2, 2): -        for is2 in range(is1**2, maxa2, is1): -            p[is2] = False -    prime_list = [i for i, b in enumerate(p) if b] -    if x in prime_list: -        print(x) -    else: -        xp = bisect(prime_list, x) -        r = prime_list[xp] -        print(r) +    while True: +        for i1 in range(2, ceil(sqrt(x))): +            if x % i1 == 0: +                x += 1 +                break +        else: +            break +    print(x)