Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-keyingi-tub-son

Next prime

Medium 1000 ms 64 MB 50%
Share

A positive integer $n$ is given. Find the smallest prime number greater than $n$.

A prime number is a positive integer greater than $1$ that is divisible only by $1$ and itself.

The first prime on the number line after the given number

Input

One positive integer $n$.

Output

One integer — the smallest prime greater than $n$.

Note

$1 \le n \le 10^{10}$

Examples

Input #1
10
Output #1
11
Input #2
13
Output #2
17

Sign in to submit a solution

Signing up is free and takes a minute.