x = int(eval(input()))

while True:

    if all(x % i != 0 for i in range(2, x)):

        print(x)

        exit()

    else:

        x+=1
def is_prime(n):

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

        if n % i == 0:

            return False

    return True



x = int(eval(input()))

while True:

    if is_prime(x):

        print(x)

        exit()

    x+=1
x = int(eval(input()))
while True:
    if all(x % i != 0 for i in range(2, x)):
        print(x)
        exit()
    else:
        x += 1

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


x = int(eval(input()))
while True:
    if is_prime(x):
        print(x)
        exit()
    x += 1

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