import sys

def input(): return sys.stdin.readline().rstrip()

def prime_list(n):

    primes = set(range(2, n+1))

    for i in range(2, int(n**0.5+1)):

        primes-=set(range(i*2, n+1, i))

    return list(primes)

def main():

    x=int(eval(input()))

    primes = prime_list(100010)

    for p in primes:

        if p >= x:

            print(p)

            break

if __name__=='__main__':

    main()
import sys

def input(): return sys.stdin.readline().rstrip()

import math

def is_prime(n):

    if n==1:return False

    for k in range(2,int(math.sqrt(n))+1):

        if n%k==0:

            return False

    return True

def main():

    x=int(eval(input()))

    while True:

        if is_prime(x)==True:

            print(x)

            break

        x+=1

if __name__=='__main__':

    main()
import sys


def input():
    return sys.stdin.readline().rstrip()


def prime_list(n):
    primes = set(range(2, n + 1))
    for i in range(2, int(n**0.5 + 1)):
        primes -= set(range(i * 2, n + 1, i))
    return list(primes)


def main():
    x = int(eval(input()))
    primes = prime_list(100010)
    for p in primes:
        if p >= x:
            print(p)
            break


if __name__ == "__main__":
    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


import math


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


def main():
    x = int(eval(input()))
    while True:
        if is_prime(x) == True:
            print(x)
            break
        x += 1


if __name__ == "__main__":
    main()

-def prime_list(n): -    primes = set(range(2, n + 1)) -    for i in range(2, int(n**0.5 + 1)): -        primes -= set(range(i * 2, n + 1, i)) -    return list(primes) +import math + + +def is_prime(n): +    if n == 1: +        return False +    for k in range(2, int(math.sqrt(n)) + 1): +        if n % k == 0: +            return False +    return True -    primes = prime_list(100010) -    for p in primes: -        if p >= x: -            print(p) +    while True: +        if is_prime(x) == True: +            print(x) +        x += 1