import sys

from pprint import pprint

import math



def is_prime(x):

    if x == 1: return False



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

        if x % k == 0:

            return False



    return True



def solve(x):

    for i in range(x, 10**6):

        if is_prime(i):

            print(i)

            return



if __name__ == '__main__':

    x = int(sys.stdin.readline().strip())

    solve(x)
import sys



X = int(sys.stdin.readline())

exists = set()

for i in range(2, X + 10**5 + 1):

    if i in exists:

        continue

    exists.add(i)

    if X <= i:

        # print(exists)

        print(i)

        sys.exit()



    for j in range(i+i, X + 10**5 + 1, i):

        exists.add(j)
import sys
from pprint import pprint
import math


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


def solve(x):
    for i in range(x, 10**6):
        if is_prime(i):
            print(i)
            return


if __name__ == "__main__":
    x = int(sys.stdin.readline().strip())
    solve(x)

import sys

X = int(sys.stdin.readline())
exists = set()
for i in range(2, X + 10**5 + 1):
    if i in exists:
        continue
    exists.add(i)
    if X <= i:
        # print(exists)
        print(i)
        sys.exit()
    for j in range(i + i, X + 10**5 + 1, i):
        exists.add(j)

-from pprint import pprint -import math - -def is_prime(x): -    if x == 1: -        return False -    for k in range(2, int(math.sqrt(x)) + 1): -        if x % k == 0: -            return False -    return True - - -def solve(x): -    for i in range(x, 10**6): -        if is_prime(i): -            print(i) -            return - - -if __name__ == "__main__": -    x = int(sys.stdin.readline().strip()) -    solve(x) +X = int(sys.stdin.readline()) +exists = set() +for i in range(2, X + 10**5 + 1): +    if i in exists: +        continue +    exists.add(i) +    if X <= i: +        # print(exists) +        print(i) +        sys.exit() +    for j in range(i + i, X + 10**5 + 1, i): +        exists.add(j)