#C5096. Minimum Total Distance Race

    ID: 48707 Type: Default 1000ms 256MiB

Minimum Total Distance Race

Minimum Total Distance Race

In this problem, you are given several datasets where each dataset represents a race among students. Each student must run at least a given minimum distance. Your task is to compute the minimum total distance that the race should cover, which is simply the sum of all individual minimum distances. Formally, if there are (n) students with required distances (d_1, d_2, \ldots, d_n), then the total minimum distance is given by (\sum_{i=1}^{n} d_i). The input contains multiple datasets and ends with a line containing a single 0.

inputFormat

The input consists of multiple test cases. For each test case, the first line contains a positive integer (n) (the number of students). The second line contains (n) space-separated integers, where each integer represents the minimum distance a student must run. The input terminates by a line containing the integer 0.

outputFormat

For each test case, print a single integer on its own line representing the minimum total distance for that case.## sample

3
5 10 8
0
23

</p>