import numpy as np

from bisect import bisect_left





def primes():

    p = []

    c = np.ones(10**5 + 10)

    c[0] = c[1] = 0

    for i, f in enumerate(c):

        if f:

            p.append(i)

            c[2 * i:10**5 + 10:i] = 0

    return p





def solve(string):

    x = int(string)

    ps = primes()

    return str(ps[bisect_left(ps, x)])





if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

def solve(string):

    x = int(string)

    for i in range(x, 2 * x):

        for j in range(2, int(i**0.5)):

            if i % j == 0:

                break

        else:

            return str(i)





if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

import numpy as np
from bisect import bisect_left


def primes():
    p = []
    c = np.ones(10**5 + 10)
    c[0] = c[1] = 0
    for i, f in enumerate(c):
        if f:
            p.append(i)
            c[2 * i : 10**5 + 10 : i] = 0
    return p


def solve(string):
    x = int(string)
    ps = primes()
    return str(ps[bisect_left(ps, x)])


if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

def solve(string):
    x = int(string)
    for i in range(x, 2 * x):
        for j in range(2, int(i**0.5)):
            if i % j == 0:
                break
        else:
            return str(i)


if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

-import numpy as np -from bisect import bisect_left - - -def primes(): -    p = [] -    c = np.ones(10**5 + 10) -    c[0] = c[1] = 0 -    for i, f in enumerate(c): -        if f: -            p.append(i) -            c[2 * i : 10**5 + 10 : i] = 0 -    return p - - -    ps = primes() -    return str(ps[bisect_left(ps, x)]) +    for i in range(x, 2 * x): +        for j in range(2, int(i**0.5)): +            if i % j == 0: +                break +        else: +            return str(i)