def genP():

	yield 2

	yield 3

	c=6

	while 1:

		yield c-1

		yield c+1

		c+=6

def sosu(n):

	if n in [2,3,5]:

		return True

	l=int(n**0.5)+1

	p=genP()

	for i in p:

		if i>l:

			return True

			break

		elif n%i==0:

			return False

			break







def resolve():

	x=int(eval(input()))

	while 1:

		if sosu(x):

			print(x)

			break

		else:

			x+=1



resolve()
def sosu(p):

	if p==2:

		return True

	l=int(p**0.5)+1

	for i in range(2,l+1):

		if p%i==0:

			return False

	return True

x=int(eval(input()))

x+=1 if x!=2 and x%2==0 else 0

while sosu(x)==False:

	x+=2

print(x)
def genP():
    yield 2
    yield 3
    c = 6
    while 1:
        yield c - 1
        yield c + 1
        c += 6


def sosu(n):
    if n in [2, 3, 5]:
        return True
    l = int(n**0.5) + 1
    p = genP()
    for i in p:
        if i > l:
            return True
            break
        elif n % i == 0:
            return False
            break


def resolve():
    x = int(eval(input()))
    while 1:
        if sosu(x):
            print(x)
            break
        else:
            x += 1


resolve()

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


x = int(eval(input()))
x += 1 if x != 2 and x % 2 == 0 else 0
while sosu(x) == False:
    x += 2
print(x)

-def genP(): -    yield 2 -    yield 3 -    c = 6 -    while 1: -        yield c - 1 -        yield c + 1 -        c += 6 +def sosu(p): +    if p == 2: +        return True +    l = int(p**0.5) + 1 +    for i in range(2, l + 1): +        if p % i == 0: +            return False +    return True -def sosu(n): -    if n in [2, 3, 5]: -        return True -    l = int(n**0.5) + 1 -    p = genP() -    for i in p: -        if i > l: -            return True -            break -        elif n % i == 0: -            return False -            break - - -def resolve(): -    x = int(eval(input())) -    while 1: -        if sosu(x): -            print(x) -            break -        else: -            x += 1 - - -resolve() +x = int(eval(input())) +x += 1 if x != 2 and x % 2 == 0 else 0 +while sosu(x) == False: +    x += 2 +print(x)