#K78222. Total Trip Distance
Total Trip Distance
Total Trip Distance
Given a list of city names and the distances between consecutive cities, compute the total distance of the trip. Formally, if the distances are provided as \(d_1, d_2, \ldots, d_k\), then the total distance is given by:
\[ Total = \sum_{i=1}^{k} d_i \]
Note that the list of cities is provided for context, but the answer is simply the sum of the distances.
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
- The first line contains an integer \(n\) representing the number of cities.
- The next \(n\) lines each contain the name of a city. (The names may include spaces.)
- The final line contains a sequence of space-separated integers, each representing the distance between consecutive cities. The number of these distances can be any non-negative integer count and does not necessarily have to be \(n-1\); the program should simply compute the sum of all given distances.
outputFormat
Output a single integer to standard output (stdout), which is the total trip distance. No extra characters or spaces should be printed.
## sample4
New York
Boston
Chicago
Dallas
215 996 925
2136
</p>