There are multiple test cases. The first line of input contains an integer \(T\ (1 \le T \le 60)\), indicating the number of test cases. For each test case: The first line contains two integers \(n \text{ and } m \ (2 \le n, m \le 10^5)\), indicating the number of bus stations and number of people. In the next line, there are \(n - 1\) integers, \(d_1, d_2, \dots, d_{n-1}\) (\(1 \le d_i \le 10^9\)). The \(i\)-th integer means the distance between bus station \(i\) and \(i + 1\) is \(d_i\) (\(1 \le i < n\)). In the next \(m\) lines, each contains two integers \(x_i\) and \(y_i\) (\(1 \le x_i, y_i \le n, x_i \ne y_i\)), which means \(i\)-th person is in bus station \(x_i\) and wants goto bus station \(y_i\). \((1 \le i \le m)\)
What else you should know is that for the \(i\)-th person, the bus starts at bus station \(((i - 1)\text{ mod } n) + 1\) and drives to right. When the bus arrives at station \(n\), it will turn around and drive from right to left. Similarly, When the bus arrives at station \(1\), it will turn around and drive from left to right. You can assume that the bus drives one meter per second. And you should only consider the time that the bus drives and ignore the others.