시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 10 8 8 80.000%

문제

bilTo pass time during their long trek through the misty mountains and to prepare for the ordeals ahead, Gandalf starts teaching Math to Bilbo and the thirteen dwarves. One of the things he teaches them is the notion of an arithmetic sequence. A sequence of numbers, x1, ..., xn, is an arithmetic sequence if the differences between successive terms in the sequence are the same. In other words, the sequence is an arithmetic sequence if: x2 - x1 = x3 - x2 = ... = xn - xn-1.

Bilbo and Ori, one of the dwarves, start playing a game to develop their skills. One of them suggests a sequence of numbers, and the other has to quickly tell whether the sequence is an arithmetic sequence, and if yes, then he also has to list the next 5 numbers in the sequence. You are to write a program to help them make sure their answers are correct.

입력

The first line in the test data file contains the number of test cases (< 100). After that, each line contains one test case: the first number is the number of entries, n, in the sequence (provided as an int), and the next n numbers are the sequence itself.

출력

For each test case, you are to either output that the sequence is not an arithmetic sequence, or you are to output the next 5 numbers in the sequence. The exact format is shown below in the examples.

예제 입력 1

3
3 1 2 3
5 4 8 12 16 20
4 1 2 3 5

예제 출력 1

The next 5 numbers after [1, 2, 3] are: [4, 5, 6, 7, 8]
The next 5 numbers after [4, 8, 12, 16, 20] are: [24, 28, 32, 36, 40]
The sequence [1, 2, 3, 5] is not an arithmetic sequence.