#K61462. Minimum Total Time Delay

    ID: 31315 Type: Default 1000ms 256MiB

Minimum Total Time Delay

Minimum Total Time Delay

You are given a communication network of satellites. The message needs to be relayed from the first satellite to the last one. For each test case, you are given an integer n denoting the total number of satellites, and a sequence of n-1 integers where each integer represents the time delay between two consecutive satellites. Your task is to calculate the minimum total time delay required to send the message, which is simply the sum of the delays between consecutive satellites.

Formally, for a test case with n satellites and delays \(d_1, d_2, \ldots, d_{n-1}\), the answer is:

[ \text{Total Delay} = \sum_{i=1}^{n-1} d_i ]

Note: Even though the problem might seem trivial, be careful with input and output handling for multiple test cases.

inputFormat

The first line of input contains an integer T (\(1 \le T \le 10^4\)), representing the number of test cases. Each test case consists of two lines:

  • The first line contains a single integer n (\(2 \le n \le 10^5\)), representing the number of satellites.
  • The second line contains n-1 space-separated integers \(d_1, d_2, \ldots, d_{n-1}\) where each \(d_i\) is the time delay between satellite \(i\) and satellite \(i+1\).

The input is given via standard input (stdin).

outputFormat

For each test case, output a single line containing the minimum total time delay required to relay the message.

The output is printed via standard output (stdout).

## sample
1
3
3 5
8

</p>