시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 12 12 12 100.000%

문제

An Arithmetic Sequence of integers is one in which the next number in the sequence is obtained by adding a constant to the current number. For example, this is an arithmetic sequence (the constant is 7):

3, 10, 17, 24, 31, …

Given a part of an arithmetic sequence with some numbers missing, fill in the missing numbers.

입력

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each test case will consist of a single line with exactly ten integers. Eight of them will be 0, the other two will be positive. The two positive integers may be anywhere among the ten integers, and will be no larger than 1,000. The 0 values represent missing values from the sequence.

출력

If it is possible to complete the sequence with integers, then output ten integers on a single line, with a single space between them, by replacing the 0 values with the correct numbers. If it is not possible to complete the sequence with integers, simply output a single -1. Although the two non-zero inputs are positive, the rest of the sequence might not be. Likewise, while the two non-zero inputs are ≤1,000, the rest of the sequence might not be.

예제 입력 1

5 0 15 0 0 0 0 0 0 0

예제 출력 1

5 10 15 20 25 30 35 40 45 50

예제 입력 2

5 0 0 15 0 0 0 0 0 0

예제 출력 2

-1

예제 입력 3

0 0 0 15 0 3 0 0 0 0

예제 출력 3

33 27 21 15 9 3 -3 -9 -15 -21

예제 입력 4

0 0 19 0 0 0 0 0 19 0

예제 출력 4

19 19 19 19 19 19 19 19 19 19