a = int(eval(input()))

def hantei(x):

    k = 0

    for i in range(2, x//2):

        if x % i == 0:

            k += 1

    if k ==0:

        return x



c = True

while c:

    hantei(a)

    b = hantei(a)

    if b is not None:

        print(b)

        c = False

    elif b is None:

        a += 1
a = int(eval(input()))

b = True

def hantei(n, x): #素数だとFalseを返す

    for i in range(2, n):

        if n % i == 0:

            x = True

            return x

while b:

    b = hantei(a, b)

    if b is None:

        print(a)

        break

    a += 1

a = int(eval(input()))


def hantei(x):
    k = 0
    for i in range(2, x // 2):
        if x % i == 0:
            k += 1
    if k == 0:
        return x


c = True
while c:
    hantei(a)
    b = hantei(a)
    if b is not None:
        print(b)
        c = False
    elif b is None:
        a += 1

a = int(eval(input()))
b = True


def hantei(n, x):  # 素数だとFalseを返す
    for i in range(2, n):
        if n % i == 0:
            x = True
            return x


while b:
    b = hantei(a, b)
    if b is None:
        print(a)
        break
    a += 1

+b = True -def hantei(x): -    k = 0 -    for i in range(2, x // 2): -        if x % i == 0: -            k += 1 -    if k == 0: -        return x +def hantei(n, x):  # 素数だとFalseを返す +    for i in range(2, n): +        if n % i == 0: +            x = True +            return x -c = True -while c: -    hantei(a) -    b = hantei(a) -    if b is not None: -        print(b) -        c = False -    elif b is None: -        a += 1 +while b: +    b = hantei(a, b) +    if b is None: +        print(a) +        break +    a += 1