Multiple test cases, at most 20. Process to the end of the file.
The first line of input contains three numbers, N, Q, (1 ≤ N ≤ 50000, 1 ≤ Q ≤ 50000) descripting the length of the circle array, the number of queries, and M mentioned above. The second line contains N positive integers less than 10^9, denotes the (1..N)th numbers of the circle array. Then comes Q lines, each line contains three number, means a query of a, b, c ( 1 ≤ a, b, c ≤ N). It's guaranteed that there's an interger i makes c = a + b * i or c + N = a + b * i;