CodeEff/ECCO huggingface dataset:
# Original solution
import math
x=int(eval(input()))
flag=True
if x==2:
    print(x)
else:
    while flag:
        i=2
        f=True
        while i<x and f:
            if x%i==0:
                f=False
            i+=1
        if f==True:
            print(x)
            flag=False
        else:
            x+=1











# Optimized solution
import math
x=int(eval(input()))
flag=True
if x==2:
    print(x)
else:
    while flag:
        i=2
        f=True
        while i<math.sqrt(x) and f:
            if x%i==0:
                f=False
            i+=1
        if f==True:
            print(x)
            flag=False
        else:
            x+=1
# Original solution
X=int(eval(input()))

f=False
a=X
if X==2:
    print("2")
    exit()
while f==False:
    for i in range(2,a+1):
        if a%i==0:
            break
        if i==a-1:
            f=True
    a+=1
print((a-1))




# Optimized solution
X=int(eval(input()))

f=False
a=X
if X==2 or X==3:
    print(X)
    exit()
while f==False:
    for i in range(2,int(a**0.5)+1):
        if a%i==0:
            break
        if i==int(a**0.5):
            f=True
    a+=1
print((a-1))
# Original solution
MAX=200000
def get_prime(x):
  is_prime = [True] * 200000
  for i in range(2,MAX):
    if is_prime[i] and i >= x:
      return i
    elif is_prime[i]:
      for j in range(2 * i, MAX, i):
        is_prime[j] = False

print((get_prime(int(eval(input())))))


# Optimized solution
# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
import sys
sys.setrecursionlimit(1000000)

x= int(eval(input()))

def prime_check(num,count):
    if (num % count) != 0:
        if num <= count**2:
            print(num)
        else:
            prime_check(num,count+1)
    else :
        prime_check(num+1,2)

if x==2 :
    print((2))
else:
    prime_check(x,2)
# Original solution
# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
import sys
sys.setrecursionlimit(1000000)

x= int(eval(input()))

def prime_check(num,count):
    if (num % count) != 0:
        if num <= count**2:
            print(num)
        else:
            prime_check(num,count+1)
    else :
        prime_check(num+1,2)

if x==2 :
    print((2))
else:
    prime_check(x,2)


# Optimized solution
# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042
x= int(eval(input()))

def prime_check(num,count):
    while True:
        while num % count == 0:
            num = num + 1
            count = 2
        if num <= count**2:
            print(num)
            break
        else:
            count = count + 1

if x==2 :
    print((2))
else:
    prime_check(x,2)
# Original solution
import math
x = int(eval(input()))

n = 10**6
flag = [True]*(n+1)

for i in range(4, n+1, 2):
  flag[i] = False
  
t = int(n**0.5)+1
for i in range(3, t, 2):
  for j in range(i+i, n+1, i):
    flag[j] = False

for i in range(x,n+1):
  if flag[i]:
    print(i)
    exit()

# Optimized solution
x = int(eval(input()))

n = 10**6
nums = [True]*(n+1)
nums[0] = nums[1] = False
for i in range(4, n+1, 2): nums[i] = False
for i in range(3, int(n**0.5)+1, 2):
  if nums[i]:
    for j in range(i+i, n, i):
      nums[j] = False

while True:
  if nums[x]:
    print(x)
    break
  x += 1
# Original solution
x = int(eval(input()))

n = 10**6
nums = [True]*(n+1)
nums[0] = nums[1] = False
for i in range(4, n+1, 2): nums[i] = False
for i in range(3, int(n**0.5)+1, 2):
  if nums[i]:
    for j in range(i+i, n, i):
      nums[j] = False

while True:
  if nums[x]:
    print(x)
    break
  x += 1

# Optimized solution
x = int(eval(input()))

flag = [True]*(10**6+1)
flag[0] = flag[1] = False

for i in range(4, 10**6+1,2): flag[i] = False
for i in range(3, int((10**6)**0.5)+1, 2):
  if flag[i]:
    for j in range(i+i, 10**6+1, i): flag[j] = False
      
while True:
  if flag[x]:
    print(x)
    exit()
  x += 1
# Original solution
x = int(eval(input()))

flag = [True]*(10**6+1)
flag[0] = flag[1] = False

for i in range(4, 10**6+1,2): flag[i] = False
for i in range(3, int((10**6)**0.5)+1, 2):
  if flag[i]:
    for j in range(i+i, 10**6+1, i): flag[j] = False
      
while True:
  if flag[x]:
    print(x)
    exit()
  x += 1

# Optimized solution
x = int(eval(input()))

nums = [True]*(10**6)
n = int(10**6**0.5)
for i in range(4, 10**6, 2): nums[i] = False
for i in range(3, n, 2):
  if nums[i]:
    for j in range(i+i, 10**6, i): nums[j] = False
      
while True:
  if nums[x]:
    print(x)
    break
  x += 1
# Original solution
def solve():
    from bisect import bisect_right, bisect, bisect_left
    x = int(eval(input()))
    n = 100100
    primes = set(range(2, n + 1))
    for i in range(2, int(n ** 0.5 + 1)):
        if i not in primes:
            i += 1
        else:
            ran = list(range(i * 2, n + 1, i))
            primes.difference_update(ran)
    primes = list(primes)
    y = bisect_left(primes, x)
    print((primes[y]))
    
    
solve()


# Optimized solution
def solve():
    x = int(eval(input()))

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

    while not is_prime(x):
        x += 1
    print(x)

solve()
# Original solution
def check(num):
    if num > 1:
        for i in range(2, num):
            if (num % i) == 0:
                return False
                break
        else:
            return True
    else:
        return False


a = int(eval(input()))

for i in range(a, 100500):
    if check(i):
        print(i)
        break

# Optimized solution
def is_prime(num):
  i = 5
  while (i * i <= num):
      if num % i == 0 or num % (i+2) ==0:
          return False
      i+=6
  return True if num > 1 and num <=3 else False if num % 2 == 0 or num % 3 == 0 or num <=1 else True

k = int(eval(input()))
if is_prime(k):
  print(k)
else:
  while(not is_prime(k)):
    k +=1
  print(k)
# Original solution
X = int(eval(input()))

n = 2 * X
is_prime = [False] * 2 + [True] * (n - 1)

for i in range(2, int(n ** 0.5) + 1): # 素数候補
    if not is_prime[i]: continue
    for j in range(2 * i, n + 1, i):
        is_prime[j] = False

for i in range(X, n):
    if is_prime[i]:
        print(i)
        break

# Optimized solution
X = int(eval(input()))

p = X
while True:
    for j in range(2, int(p ** 0.5) + 1):
        if p % j == 0: break
    else:
        break
    p += 1

print(p)
# Original solution
import sys
input=sys.stdin.readline
X = int(eval(input()))
prime = [2]
if X == 2:
    print((2))
else:
    for i in range(2,X):
        c = 0
        for j in prime:
            if i % j == 0:
                c = 1
                break
        if c == 0:
            prime.append(i)
    for i in range(X,X + 1000):
        c = 0
        for j in prime:
            if i % j == 0:
                c = 1
                break
        if c == 0:
            print(i)
            break

# Optimized solution
import sys
input=sys.stdin.readline
import math
X = int(eval(input()))
if X == 2:
    print((2))
else:
  x = math.ceil(math.sqrt(X))
  for i in range(X,X+1000):
      c = 0
      for j in range(2,x+1):
          if i % j == 0:
              c = 1
              break
      if c == 0:
          print(i)
          break
# Original solution
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def prime(ulim=10**5+10):
  cands = [2] + list(range(3, ulim, 2))
  while len(cands) != 0:
    prime = cands.pop(0)
    cands = [x for x in cands if x%prime != 0]
    yield prime

if __name__=='__main__':
  x = int(eval(input()))
  for p in prime():
    if p >= x:
      print(p)
      break

# Optimized solution
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

from math import sqrt

def prime(ulim=10**5+10):
  cands = [2] + list(range(3, ulim, 2))
  primes = []
  while True:
    prime = cands.pop(0)
    primes.append(prime)
    if prime > sqrt(ulim):
      primes += cands
      break
    cands = [x for x in cands if x%prime != 0]
  return primes


if __name__=='__main__':
  x = int(eval(input()))
  for p in prime():
    if p >= x:
      print(p)
      break
# Original solution
X=int(eval(input()))
flag=1
if X==2:
    flag=0
 
while(flag==1):
    for i in range(2,X+1):
        if(X%i==0):
            X+=1
          
            break
        if(i==X-1):
       
            flag=0
            break
 
print(X)

# Optimized solution
X=int(eval(input()))

def prime(N):
  for i in range(2,N-1):
    if N%i==0:
      return -1
  
  return N

for x in range(X,10**10):
  if prime(x)==x:
    print(x)
    break
# Original solution
import bisect
x = int(eval(input()))

def get_prime(n):
  if n <= 1: return []
  limit = int(n**0.5)
  prime = [2]
  data = [i+1 for i in range(2,n,2)]
  while limit >= data[0]:
    prime.append(data[0])
    data = [j for j in data if j % data[0] != 0]
  return prime + data

l = get_prime(10**5+3)
i = bisect.bisect_right(l, x)
if l[i-1] == x: print(x)
else: print((l[i]))

# Optimized solution
x = int(eval(input()))

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

if not is_prime(x):
  while not is_prime(x):
    x += 1
print(x)
# Original solution
prims = list()

prims.append(2)

base = int(eval(input()))

def _is_prim(n):
  global prims
  for p in prims:
    if n == p:
      return True
    elif n % p == 0:
      return False
  
  return True

# 入力値までの素数を作る
for n in range(base):
  if n < 2:
    continue
  elif n % 2 == 0:
    continue
  elif _is_prim(n):
    prims.append(n)

# 作った素数値で。。。
while not _is_prim(base):
  base += 1

print(base)    


# Optimized solution
import math

prims = list()

prims.append(2)

base = int(eval(input()))

def _is_prim(n):
  global prims
  for p in prims:
    if n == p:
      return True
    elif n % p == 0:
      return False
  
  return True

# 入力値の平方根までの素数を作る
rt = int(math.sqrt(base))
for n in range(rt):
  if n < 2:
    continue
  elif n % 2 == 0:
    continue
  elif _is_prim(n):
    prims.append(n)

# 作った素数値で。。。
while not _is_prim(base):
  base += 1

print(base)
# Original solution
n = int(eval(input()))
const = 10**5+100

a = [i for i in range(2,const+1)]
prime = []

for i in a:
    prime.append(i)

    if i > int(n**0.5):
        break

    a = [j for j in a if j % i != 0]

prime += a

ans = [i for i in a if i >= n][0]

print(ans)

# Optimized solution
import sys

n = int(eval(input()))

while True:
    for i in range(2, int(n**0.5+1)):
        if n % i == 0:
            break
    else:
        print(n)
        sys.exit()

    n = n + 1
# Original solution
X = int(eval(input()))

def notco(x, lst):
  for i in range(len(lst)):
    if x % lst[i] == 0:
      return False
  return True

def minp(x):
  primes = [2]
  i = 3
  while(primes[len(primes)-1] < x):
    if notco(i, primes):
      primes.append(i)
    i += 1
  return primes[len(primes)-1]

print((minp(X)))

# Optimized solution
X = int(eval(input()))

def isprime(x):
  for i in range(2, x//2+1):
    if x % i == 0:
      return False
  return True

def minp(x):
  res = x
  while True:
    if isprime(res):
      return res
    res += 1

print((minp(X)))
# Original solution
x = int(eval(input()))
tmp = 0

if x == 2:
  print((2))
  exit()
for i in range(x,10**111):
  for j in range(2,(i//2)+2):
    tmp += 1
    if i%j == 0:
      break
    elif tmp == (i//2):
      print(i)
      exit()
      


# Optimized solution
x = int(eval(input()))
tmp = 0

if x == 2:
  print((2))
  exit()
for i in range(x,10**111):
  for j in range(2,(i//2)+2):
    tmp += 1
    if i%j == 0:
      tmp = 0
      break
    elif tmp == (i//2):
      print(i)
      exit()
# Original solution
maxA = 10**6

X = int(eval(input()))

def getIsPrimes(n):
    isPrimes = [False]*2 + [True]*(n-1)
    for x in range(2*2, n+1, 2):
        isPrimes[x] = False
    for d in range(3, int(n**0.5)+1):
        if isPrimes[d]:
            for x in range(d*d, n+1, d):
                isPrimes[x] = False
    return isPrimes

isPrimes = getIsPrimes(maxA)

for i in range(X, maxA+1):
    if isPrimes[i]:
        print(i)
        break



# Optimized solution
maxA = 10**5 + 3

X = int(eval(input()))

def isPrime(x):
    for d in range(2, int(x**0.5)+1):
        if x%d == 0:
            return False
    return x != 1

for i in range(X, maxA+1):
    if isPrime(i):
        print(i)
        break
# Original solution
# -*- Coding: utf-8 -*-

x = int(eval(input()))
min_sosu = x
flg_found = False

for i in range(x, 1000000):
    for j in range(2, i*i):
        if i%j == 0 and j < x:
            break
        if i%j == 0 and j >= x and i == j:
            min_sosu = i
            flg_found = True
            print(min_sosu)
            break
    if flg_found:
        break


# Optimized solution
# -*- Coding: utf-8 -*-
import math

def is_prime(x):
    if x <=1:
        return False

    for i in range(2, int(math.sqrt(x)+1)):
        if x%i == 0:
            return False
    
    return True

x = int(eval(input()))

while(not is_prime(x)): x+=1

print(x)
# Original solution
X = int(eval(input()))

while True:
  flag = True
  for i in range(2, X):
    if X % i == 0:
      flag = False
  
  if flag: break
  X += 1
  
print(X)

# Optimized solution
X = int(eval(input()))
  
# 順に素数判定を行えばよい
def is_prime(x):
  if x <= 1:
    return False
  for i in range(2, x):
    if x % i == 0:
      return False
  return True
 
p = X
while not is_prime(p):
  p += 1
  
print(p)
# Original solution
N = int(eval(input()))
while True:
    judge = 1
    for i in range(2, N):
        if N % i == 0:
            judge *= N % i  #素数だとjudgeが0にならない
            break
        else:
            judge *= N % i  #素数だとjudgeが0にならない
    if judge >= 1:
        print(N)
        exit()
    N += 1

# Optimized solution
import math

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

N = int(eval(input()))
while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1
# Original solution
X = int(eval(input()))

memo = [None]*(2*X)

for i,v in enumerate(memo):
    if i < 2:
        continue
    if v is None:
        memo[i] = True
        for j in range(i*2, 2*X, i):
            memo[j] = False

print((next(i+X for i,v in enumerate(memo[X:]) if v)))

# Optimized solution

# 素因数分解
def prime_factors(n):
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            yield i
    if n > 1:
        yield n

from itertools import count

X = int(eval(input()))

for x in count(X):
    if len(tuple(prime_factors(x))) == 1:
        print(x)
        break
# Original solution
x = int(eval(input()))

while True:
    for i in range(2, x):
        if x % i == 0:
            break
    else:
        print(x)
        break
    x += 1


# Optimized solution
x = int(eval(input()))

while True:
    for i in range(2, int(x**0.5+1)):
        if x % i == 0:
            break
    else:
        print(x)
        break
    x += 1
# Original solution
x = int(eval(input()))
if x == 2:
    print((2))
    exit()
i = 3
f = False
while True:
    if x % 2 == 0:
        x += 1
        continue
    while i * i <= x:
        if x % i == 0:
            i += 2
            f = True
            break
        else:
            i += 2
    if not f:
        print(x)
        exit()
    x += 1
    i = 3
    f = False

# Optimized solution
x = int(eval(input()))
i = 2
while True:
    while i * i <= x:
        if x % i == 0:
            break
        i += 1
    else:
        print(x)
        exit()
    i = 2
    x += 1
# Original solution
def is_prime(n):
    if n == 1:
        return False
    return all(n % i != 0 for i in range(2, int(n**0.5) + 1))

x = int(eval(input()))
print((min(i for i in range(x, 100004) if is_prime(i))))

# Optimized solution
def is_prime(n):
    if n == 1:
        return False
    return all(n % i != 0 for i in range(2, int(n**0.5) + 1))

x = int(eval(input()))
while not is_prime(x):
    x += 1
print(x)
# Original solution
# エラトステネスの篩
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


X = int(eval(input()))

N = 10 ** 6
prime_table = make_prime_table(N)
for i in range(X, N + 1):
    if prime_table[i] == i:
        print(i)
        break


# Optimized solution
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(4, n + 1, 2):
        sieve[i] = 2
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i * 2):
            if sieve[j] == j:
                sieve[j] = i
    return sieve

X = int(eval(input()))

N = 10 ** 6
prime_table = make_prime_table(N)
for i in range(X, N + 1):
    if prime_table[i] == i:
        print(i)
        break
# Original solution
a = int(eval(input()))
flag = 0
j = 0
while(flag != 1):
    count =0
    temp = a+j
    for i in range(2, temp):
        if(temp %i == 0):
            count +=1
    if(count == 0):
        flag =1
        print(temp)
    j+=1

# Optimized solution
import math 

def isPrime(n): 

    if(n <= 1): 
        return False
    if(n <= 3): 
        return True

    if(n % 2 == 0 or n % 3 == 0): 
        return False
      
    for i in range(5,int(math.sqrt(n) + 1), 6):  
        if(n % i == 0 or n % (i + 2) == 0): 
            return False
      
    return True
  
def nextPrime(N): 

    if (N <= 1): 
        return 2
  
    prime = N 
    found = False

    while(not found): 
        prime = prime + 1
  
        if(isPrime(prime) == True): 
            found = True
  
    return prime 

N = int(eval(input()))
print((nextPrime(N-1)))
# Original solution
x = int(eval(input()))


def prime_factorize(n):
    r = []
    while n % 2 == 0:
        r.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            r.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        r.append(n)
    return r


for i in range(x, x+100):
    l = prime_factorize(i)
    if i in l:
        l.remove(i)
    if not l:
        print(i)
        exit()

# Optimized solution
x = int(eval(input()))


def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    m = int(n**0.5)+1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
    return True


while not isPrime(x):
    x += 1
print(x)
# Original solution
import sys
n = int(eval(input()))
for i in range(n,2*n):
    chk = True
    for j in range(2,n):
        if i%j==0:
            chk=False
    if chk==True:
        print(i)
        sys.exit()


# Optimized solution
x = int(eval(input()))
def is_prime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i != 0:
            continue
        else:
            return False
    return True
while  True:
    if is_prime(x) == True:
        break
    else:
        x +=1
print(x)
# Original solution
import sys
import math

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

x = int(eval(input()))

for i in range(x, 10**5+4):
    if is_prime(i):
        print(i)
        sys.exit()

# Optimized solution
import sys
import math

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

x = int(eval(input()))

if x == 2:
    print(x)
    sys.exit()

for i in range(x, 10**5+4):
    if i % 2 == 1 and is_prime(i):
        print(i)
        sys.exit()
# Original solution
x = int(eval(input()))
prime_table = []

def judge(n):
    for i in prime_table:
        if n%i == 0:
            return False
    prime_table.append(n)
    return True

num = 1
p = True
while p == True:
    num += 1
    if judge(num) == True:
        if num >= x:
            p = False

print(num)

# Optimized solution
x = int(eval(input()))

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, x):
        if x%i == 0:
            return False
    return True

while is_prime(x) == False:
    x += 1

print(x)
# Original solution
x = int(eval(input()))

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, x):
        if x%i == 0:
            return False
    return True

while is_prime(x) == False:
    x += 1

print(x)

# Optimized solution
import math

x = int(eval(input()))

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

while is_prime(x) == False:
    x += 1

print(x)
# Original solution
#!/usr/bin/env python3

def main():
    x = int(eval(input()))
    primes = furui(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

def furui(nmax):
    assert nmax > 2
    p = 2
    primes = list(range(2, nmax + 1))
    while True:
        if p ** 2 > nmax:
            break
        primes_next = []
        for x in primes:
            if x <= p or x % p != 0:
                primes_next.append(x)
        primes = primes_next
        p = primes[primes.index(p) + 1]
    return primes

if __name__ == "__main__":
    main()


# Optimized solution
#!/usr/bin/env python3

def main():
    x = int(eval(input()))
    primes = furui(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

# https://mathtrain.jp/eratosthenes
def furui(nmax):
    assert nmax > 2
    p = 2
    primes = list(range(2, nmax + 1))
    while True:
        if p ** 2 > nmax:
            break
        primes_next = []
        for x in primes:
            if x <= p or x % p != 0:
                primes_next.append(x)
        primes = primes_next
        p = primes[primes.index(p) + 1]
    return primes

if __name__ == "__main__":
    main()
# Original solution
#!/usr/bin/env python3

def main():
    x = int(eval(input()))
    primes = furui(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

# https://mathtrain.jp/eratosthenes
def furui(nmax):
    assert nmax > 2
    p = 2
    primes = list(range(2, nmax + 1))
    while True:
        if p ** 2 > nmax:
            break
        primes_next = []
        for x in primes:
            if x <= p or x % p != 0:
                primes_next.append(x)
        primes = primes_next
        p = primes[primes.index(p) + 1]
    return primes

if __name__ == "__main__":
    main()


# Optimized solution
#!/usr/bin/env python3

def main():
    x = int(eval(input()))
    primes = sieve(300000)
    for p in primes:
        if x <= p:
            print(p)
            return
    raise ValueError

# O(nloglogn) https://mathtrain.jp/eratosthenes
def sieve(n):  # exclusive
    s = [True] * n
    for x in range(2, int(n**0.5) + 1):
        if s[x]:
            for i in range(2 * x, n, x):
                s[i] = False
    return [i for i in range(2, n) if s[i]]

if __name__ == "__main__":
    main()
# Original solution
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

import bisect
n = int(eval(input()))
prime_table = prime(10**6)
print((prime_table[bisect.bisect_left(prime_table,n)]))

# Optimized solution
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

import bisect
x = int(eval(input()))
pt = prime(5*10**5)
print((pt[bisect.bisect_left(pt,x)]))