#C12612. Total Distance Calculation
Total Distance Calculation
Total Distance Calculation
You are given a series of recorded trip distances. Your task is to calculate the overall distance covered by summing these individual distances. The total distance is given by the formula:
\(D = \sum_{i=1}^{n} d_i\)
Here, \(n\) is the number of trips and \(d_i\) is the distance of the i-th trip. Some trips might record negative values (which could indicate corrections or returns), but the total distance is simply the sum of all provided values.
Input and output should be handled via standard input (stdin) and standard output (stdout) respectively.
inputFormat
The input consists of two lines:
- An integer \(n\) denoting the number of trips.
- A line containing \(n\) space-separated floating-point numbers representing the distance of each trip. If \(n = 0\), the second line may be empty.
outputFormat
Output a single floating-point number representing the total distance covered. The result should be printed with exactly one digit after the decimal point.
## sample1
15.2
15.2
</p>