#C9897. Final Train Station
Final Train Station
Final Train Station
You are given a starting station number and a series of movements. For each movement, the train changes its station number by the movement value. The final station is computed by adding each movement sequentially from the starting station.
If at any point the station number becomes less than 1, the entire test case is declared as Invalid Station.
Formally, let \( S \) be the starting station and let \( m_1, m_2, \ldots, m_n \) be the movements. The final station \( F \) is computed as:
\[ F = S + \sum_{i=1}^{n} m_i, \]provided that for all partial sums \( S + \sum_{i=1}^{k} m_i \ge 1 \) for \(1 \le k \le n\). Otherwise, the answer is Invalid Station.
inputFormat
The first line of input contains an integer \( T \) representing the number of test cases. For each test case, the first line contains two integers: the starting station \( S \) and the number of movements \( M \). If \( M > 0 \), the next line contains \( M \) space-separated integers representing the movements.
All input is provided via standard input (stdin).
outputFormat
For each test case, output a single line containing the final station number as a string. If at any point the station number becomes less than 1, output Invalid Station
instead.
All output should be written to standard output (stdout).
## sample3
5 3
2 -4 3
1 2
-1 -2
7 4
1 2 -3 4
6
Invalid Station
11
</p>