x=int(eval(input()))





if x==2 or x==3:

    print(x)

else:

    i=x

    flag=True

    while i<=100003 and flag==True:

        flag=False

        for j in range(2,int(i**(1/2)//1+1)):

            if i%j==0:

                flag=True

                break

        i+=1

    print((i-1))
x=int(eval(input()))

flag=True

while flag:

    i=2

    fla=True

    while i<=x**0.5:

        if x%i==0:

            fla=False

            break

        else:

            if i==2:

                i+=1

            else:

                i+=2

    if fla==False:

        x+=1

    else:

        print(x)

        flag=False
x = int(eval(input()))
if x == 2 or x == 3:
    print(x)
else:
    i = x
    flag = True
    while i <= 100003 and flag == True:
        flag = False
        for j in range(2, int(i ** (1 / 2) // 1 + 1)):
            if i % j == 0:
                flag = True
                break
        i += 1
    print((i - 1))

x = int(eval(input()))
flag = True
while flag:
    i = 2
    fla = True
    while i <= x**0.5:
        if x % i == 0:
            fla = False
            break
        else:
            if i == 2:
                i += 1
            else:
                i += 2
    if fla == False:
        x += 1
    else:
        print(x)
        flag = False

-if x == 2 or x == 3: -    print(x) -else: -    i = x -    flag = True -    while i <= 100003 and flag == True: +flag = True +while flag: +    i = 2 +    fla = True +    while i <= x**0.5: +        if x % i == 0: +            fla = False +            break +        else: +            if i == 2: +                i += 1 +            else: +                i += 2 +    if fla == False: +        x += 1 +    else: +        print(x) -        for j in range(2, int(i ** (1 / 2) // 1 + 1)): -            if i % j == 0: -                flag = True -                break -        i += 1 -    print((i - 1))