import math

 

number = int(eval(input()))

 

def is_prime(n):

    if n == 1: return False



    for k in range(2, int(math.sqrt(n)) + 1):

        if n % k == 0:

            return False

    return True



for i in range(10000000):

    if is_prime(number):

        print(number)

        break

    else:

        number += 1

import math

def isPrime(n):

  if n == 1: return False



  for k in range(2, int(math.sqrt(n)) + 1):

    if n % k == 0:

      return False

  return True



x = int(eval(input()))



for i in range(10**5):

  if isPrime(x+i):

    print((x+i))

    break

import math

number = int(eval(input()))


def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


for i in range(10000000):
    if is_prime(number):
        print(number)
        break
    else:
        number += 1

import math


def isPrime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


x = int(eval(input()))
for i in range(10**5):
    if isPrime(x + i):
        print((x + i))
        break

-number = int(eval(input())) - -def is_prime(n): +def isPrime(n): -for i in range(10000000): -    if is_prime(number): -        print(number) +x = int(eval(input())) +for i in range(10**5): +    if isPrime(x + i): +        print((x + i)) -    else: -        number += 1