def is_prime(a):

    if a == 2:

        return True

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

        if a%i == 0:

            return False

    return True



X = int(eval(input()))



for i in range(X, 100004):

    if is_prime(i):

        print(i)

        break
def is_prime(a):

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

        if a%i == 0:

            return False

    return True



X = int(eval(input()))



for i in range(X, 100004):

    if is_prime(i):

        print(i)

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


X = int(eval(input()))
for i in range(X, 100004):
    if is_prime(i):
        print(i)
        break

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


X = int(eval(input()))
for i in range(X, 100004):
    if is_prime(i):
        print(i)
        break

-    if a == 2: -        return True -    for i in range(2, int(a**0.5) + 2): +    for i in range(2, int(a**0.5) + 1):