X = int(eval(input()))



import math



# Mまでの素数全列挙(エラトステネスの篩)

def primes(M):

    is_prime = [-1 for _ in range(M+1)]

    for m in range(2, M+1):

        if is_prime[m] == -1:

            is_prime[m] = 1

            l = 2

            while m*l <= M:

                is_prime[m*l] = 0

                l += 1

    primes = []

    for p in range(2, M+1):

        if is_prime[p] == 1:

            primes.append(p)

    return primes



ps = primes(2*10**5)



for p in ps:

    if p >= X:

        print(p)

        break
N = int(eval(input()))



import math



# Mまでの素数全列挙(エラトステネスの篩)

def primes(M):

    is_prime = [-1 for _ in range(M+1)]

    for m in range(2, M+1):

        if is_prime[m] == -1:

            is_prime[m] = 1

            l = 2

            while m*l <= M:

                is_prime[m*l] = 0

                l += 1

    primes = []

    for p in range(2, M+1):

        if is_prime[p] == 1:

            primes.append(p)

    return primes





P = primes(2*N)

ans = -1

for p in P:

    if p >= N:

        ans = p

        break

print(ans)
X = int(eval(input()))
import math

# Mまでの素数全列挙(エラトステネスの篩)
def primes(M):
    is_prime = [-1 for _ in range(M + 1)]
    for m in range(2, M + 1):
        if is_prime[m] == -1:
            is_prime[m] = 1
            l = 2
            while m * l <= M:
                is_prime[m * l] = 0
                l += 1
    primes = []
    for p in range(2, M + 1):
        if is_prime[p] == 1:
            primes.append(p)
    return primes


ps = primes(2 * 10**5)
for p in ps:
    if p >= X:
        print(p)
        break

N = int(eval(input()))
import math

# Mまでの素数全列挙(エラトステネスの篩)
def primes(M):
    is_prime = [-1 for _ in range(M + 1)]
    for m in range(2, M + 1):
        if is_prime[m] == -1:
            is_prime[m] = 1
            l = 2
            while m * l <= M:
                is_prime[m * l] = 0
                l += 1
    primes = []
    for p in range(2, M + 1):
        if is_prime[p] == 1:
            primes.append(p)
    return primes


P = primes(2 * N)
ans = -1
for p in P:
    if p >= N:
        ans = p
        break
print(ans)

-X = int(eval(input())) +N = int(eval(input())) -ps = primes(2 * 10**5) -for p in ps: -    if p >= X: -        print(p) +P = primes(2 * N) +ans = -1 +for p in P: +    if p >= N: +        ans = p +print(ans)