#K8056. Total Weight of Packages Exceeding 5 KG
Total Weight of Packages Exceeding 5 KG
Total Weight of Packages Exceeding 5 KG
You are given a list of package weights. Your task is to calculate the total weight of all packages that weigh more than 5 kilograms.
Formally, given a list of integers \( w_1, w_2, \ldots, w_n \), you need to compute:
\[ \text{Total Weight} = \sum_{i=1}^{n} \{ w_i \mid w_i > 5 \} \]Input is taken from standard input and output should be written to standard output.
Example: For the list [3, 2, 8, 15, 5, 6, 12, 3, 1, 10], the packages with weights 8, 15, 6, 12, and 10 are counted, yielding a total \(8 + 15 + 6 + 12 + 10 = 51\).
inputFormat
The first line contains a single integer \(n\) — the number of packages. The second line contains \(n\) space-separated integers representing the weights of the packages.
outputFormat
Output a single integer — the total weight of all packages that weigh more than 5 kilograms.
## sample10
3 2 8 15 5 6 12 3 1 10
51