#K59922. Total Travel Time Calculation
Total Travel Time Calculation
Total Travel Time Calculation
You are given (T) test cases. For each test case, you are provided with an integer (n) which represents the number of cities. There are exactly (n-1) intervals between the cities. For each interval, you are given the expected travel time and the expected delay. The total travel time for a test case is defined as follows:
[ \text{Total Time} = \sum_{i=1}^{n-1} \left( \text{travel time}_i + \text{delay}_i \right)]
Your task is to compute the total travel time for each test case. Read the input from standard input (stdin) and output the results to standard output (stdout), each on a new line.
inputFormat
The first line contains a single integer (T), the number of test cases. For each test case:
- The first line contains an integer (n) (the number of cities).
- The second line contains (n-1) integers, representing the travel times between consecutive cities.
- The third line contains (n-1) integers, representing the delays between consecutive cities.
All input is provided through standard input (stdin).
outputFormat
For each test case, output a single integer on a new line — the total travel time calculated as the sum of the travel times and delays.## sample
1
4
3 5 2
1 3 4
18