#K7006. Sum of Prime Numbers

    ID: 33224 Type: Default 1000ms 256MiB

Sum of Prime Numbers

Sum of Prime Numbers

You are given a list of integers. Your task is to determine the sum of all prime numbers in the list. A number \(n\) is considered prime if it satisfies the following conditions:

  • \(n > 1\).
  • Only divisible by 1 and itself.
  • For example, \(2,3,5,7,11\) are primes while \(1,4,6,8\) are not.

You need to read the input from standard input (stdin) and print the answer to standard output (stdout).

Function Details:

// Check if a number is prime
bool is_prime(int n);

// Calculate the sum of primes in the list int sum_of_primes(List of integers lst);

</p>

Note: All formulas are represented in LaTeX format.

inputFormat

The input consists of two lines:

  1. The first line contains an integer \(n\) representing the number of elements in the list.
  2. The second line contains \(n\) space-separated integers.

You should read input from stdin.

outputFormat

Output a single integer which is the sum of all prime numbers in the given list. Print the result to stdout.

## sample
6
3 4 7 6 11 13
34

</p>