import sys

n = int(eval(input()))

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

    chk = True

    for j in range(2,n):

        if i%j==0:

            chk=False

    if chk==True:

        print(i)

        sys.exit()

x = int(eval(input()))

def is_prime(n):

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

        if n%i != 0:

            continue

        else:

            return False

    return True

while  True:

    if is_prime(x) == True:

        break

    else:

        x +=1

print(x)

import sys

n = int(eval(input()))
for i in range(n, 2 * n):
    chk = True
    for j in range(2, n):
        if i % j == 0:
            chk = False
    if chk == True:
        print(i)
        sys.exit()

x = int(eval(input()))


def is_prime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i != 0:
            continue
        else:
            return False
    return True


while True:
    if is_prime(x) == True:
        break
    else:
        x += 1
print(x)

-import sys +x = int(eval(input())) -n = int(eval(input())) -for i in range(n, 2 * n): -    chk = True -    for j in range(2, n): -        if i % j == 0: -            chk = False -    if chk == True: -        print(i) -        sys.exit() + +def is_prime(n): +    for i in range(2, int(n**0.5) + 1): +        if n % i != 0: +            continue +        else: +            return False +    return True + + +while True: +    if is_prime(x) == True: +        break +    else: +        x += 1 +print(x)