#K52342. Sum of Primes
Sum of Primes
Sum of Primes
Given an integer N, your task is to compute the sum of all prime numbers less than or equal to N. A prime number is defined as an integer greater than 1 that has no positive divisors other than 1 and itself. The mathematical definition can be expressed in LaTeX as:
\( p \text{ is prime if } p > 1 \text{ and } \forall d \; (1 < d < p \Rightarrow d \nmid p) \).
Make sure your program reads input from stdin and writes the output to stdout.
inputFormat
The input consists of a single line containing a positive integer N (1 ≤ N ≤ 106).
outputFormat
Output a single integer which is the sum of all prime numbers that are less than or equal to N.
## sample10
17