#C2713. Smallest Prime with Prime Sum

    ID: 46060 Type: Default 1000ms 256MiB

Smallest Prime with Prime Sum

Smallest Prime with Prime Sum

Given an integer \(n\), your task is to find the smallest prime number \(p\) such that both \(p\) and \(p+n\) are prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, when \(n = 10\), the number \(3\) is the smallest prime since both \(3\) and \(3+10=13\) are primes.

More formally, find the minimum prime \(p\) satisfying:

[ \text{is_prime}(p) = \text{True} \quad \text{and} \quad \text{is_prime}(p+n) = \text{True} ]

inputFormat

The input consists of a single line containing one integer \(n\) (for example, \(0 \leq n \leq 1000\)).

outputFormat

Output a single integer: the smallest prime number \(p\) such that both \(p\) and \(p+n\) are prime numbers.

## sample
10
3