#K42537. Total Length of Valid Fish

    ID: 27109 Type: Default 1000ms 256MiB

Total Length of Valid Fish

Total Length of Valid Fish

John's fishing log records the length of each fish he caught, but only entries with strictly positive values are considered valid. Given an integer n representing the number of records, and a list of n integers denoting the fish lengths, your task is to compute the total length of valid fish.

A fish is considered valid if its length is a positive integer. For example, if the fish lengths are [10, -2, 30, 0, 15], the valid fish are 10, 30, and 15, and their total length is 55.

Input and Output: Read input from stdin and write the output to stdout.

Mathematical Note: The sum can be expressed in LaTeX as \( \sum_{i=1}^{n} f_i \) where \( f_i > 0 \) for valid fish.

inputFormat

The input consists of two lines:

  1. The first line contains a single integer ( n ) (the number of fish records).
  2. The second line contains ( n ) space-separated integers representing the fish lengths.

outputFormat

Output a single integer representing the total length of valid fish (only those fish with strictly positive lengths).## sample

5
10 20 30 5 15
80

</p>