import math

x=int(eval(input()))

flag=True

if x==2:

    print(x)

else:

    while flag:

        i=2

        f=True

        while i<x and f:

            if x%i==0:

                f=False

            i+=1

        if f==True:

            print(x)

            flag=False

        else:

            x+=1



















import math

x=int(eval(input()))

flag=True

if x==2:

    print(x)

else:

    while flag:

        i=2

        f=True

        while i<math.sqrt(x) and f:

            if x%i==0:

                f=False

            i+=1

        if f==True:

            print(x)

            flag=False

        else:

            x+=1



















import math

x = int(eval(input()))
flag = True
if x == 2:
    print(x)
else:
    while flag:
        i = 2
        f = True
        while i < x and f:
            if x % i == 0:
                f = False
            i += 1
        if f == True:
            print(x)
            flag = False
        else:
            x += 1

import math

x = int(eval(input()))
flag = True
if x == 2:
    print(x)
else:
    while flag:
        i = 2
        f = True
        while i < math.sqrt(x) and f:
            if x % i == 0:
                f = False
            i += 1
        if f == True:
            print(x)
            flag = False
        else:
            x += 1

-        while i < x and f: +        while i < math.sqrt(x) and f: