X = int(eval(input()))

def primes(n):

    is_prime = [True] * (n + 1)

    is_prime[0] = False

    is_prime[1] = False

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

        if not is_prime[i]:

            continue

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

            is_prime[j] = False

    return [i for i in range(n + 1) if is_prime[i]]

data = primes(2*X)

for i in range(len(data)):

    if data[i] >= X:

        ans = data[i]

        break

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

def is_prime(x):

    flag = True

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

        if x % i == 0:

            flag = False

    return flag

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

    if is_prime(i):

        print(i)

        break
X = int(eval(input()))


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


data = primes(2 * X)
for i in range(len(data)):
    if data[i] >= X:
        ans = data[i]
        break
print(ans)

X = int(eval(input()))


def is_prime(x):
    flag = True
    for i in range(2, int(x ** (0.5)) + 1):
        if x % i == 0:
            flag = False
    return flag


for i in range(X, 2 * X + 1):
    if is_prime(i):
        print(i)
        break

-def primes(n): -    is_prime = [True] * (n + 1) -    is_prime[0] = False -    is_prime[1] = False -    for i in range(2, int(n**0.5) + 1): -        if not is_prime[i]: -            continue -        for j in range(i * 2, n + 1, i): -            is_prime[j] = False -    return [i for i in range(n + 1) if is_prime[i]] +def is_prime(x): +    flag = True +    for i in range(2, int(x ** (0.5)) + 1): +        if x % i == 0: +            flag = False +    return flag -data = primes(2 * X) -for i in range(len(data)): -    if data[i] >= X: -        ans = data[i] +for i in range(X, 2 * X + 1): +    if is_prime(i): +        print(i) -print(ans)