#探索範囲増やすとどのくらい時間が伸びるのか



x=int(eval(input()))



def is_prime(p):

  cnt=0

  for i in range(2,p):

    if p%i==0:

      cnt+=1

  if cnt==0:

    return True

  #2からp-1までみて、cntが0ならpは素数

  else:

    return False

      

#print(*[(x,is_prime(x)) for x in range(1,10+1)])

num=x

while True:

  if is_prime(num):

    ans=num

    break

  num+=1

print(ans)

x=int(eval(input()))



mod=10**7+9

for i in range(x,mod):

  if not any(i%j==0 for j in range(2,i+1-1)):

    ans=i

    break

    

print(ans)
# 探索範囲増やすとどのくらい時間が伸びるのか
x = int(eval(input()))


def is_prime(p):
    cnt = 0
    for i in range(2, p):
        if p % i == 0:
            cnt += 1
    if cnt == 0:
        return True
    # 2からp-1までみて、cntが0ならpは素数
    else:
        return False


# print(*[(x,is_prime(x)) for x in range(1,10+1)])
num = x
while True:
    if is_prime(num):
        ans = num
        break
    num += 1
print(ans)

x = int(eval(input()))
mod = 10**7 + 9
for i in range(x, mod):
    if not any(i % j == 0 for j in range(2, i + 1 - 1)):
        ans = i
        break
print(ans)

-# 探索範囲増やすとどのくらい時間が伸びるのか - - -def is_prime(p): -    cnt = 0 -    for i in range(2, p): -        if p % i == 0: -            cnt += 1 -    if cnt == 0: -        return True -    # 2からp-1までみて、cntが0ならpは素数 -    else: -        return False - - -# print(*[(x,is_prime(x)) for x in range(1,10+1)]) -num = x -while True: -    if is_prime(num): -        ans = num +mod = 10**7 + 9 +for i in range(x, mod): +    if not any(i % j == 0 for j in range(2, i + 1 - 1)): +        ans = i -    num += 1