#K13541. Summing Primes

    ID: 23935 Type: Default 1000ms 256MiB

Summing Primes

Summing Primes

Given an integer (n), your task is to calculate the sum of all prime numbers less than or equal to (n). A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.

The recommended efficient approach is to use the Sieve of Eratosthenes. Ensure that your solution reads the input from standard input (stdin) and writes the result to standard output (stdout).

inputFormat

The input consists of a single integer (n), provided via standard input.

outputFormat

Output a single integer representing the sum of all prime numbers less than or equal to (n). The answer should be printed to standard output.## sample

10
17