#K68252. Sum of Consecutive Primes

    ID: 32823 Type: Default 1000ms 256MiB

Sum of Consecutive Primes

Sum of Consecutive Primes

Given a non-negative integer n, your task is to compute the sum of the first n prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In particular, if n is 0, then the sum should be 0.

The formula for the sum when n > 0 can be expressed as:

S=i=1npiS = \sum_{i=1}^{n} p_i

where \( p_i \) denotes the i-th prime number.

You are required to read the input from standard input (STDIN) and output the result to standard output (STDOUT).

inputFormat

The input consists of a single line containing an integer n (0 \( \leq n \leq 10^5 \) for example) which represents the number of consecutive prime numbers to sum up.

outputFormat

Output a single integer, which is the sum of the first n consecutive prime numbers.

## sample
1
2