Hard to Miss


Matt is watching the shooting finals.

There are nn marksmen standing next to each other along the shooting range, numbered from 11 to nn from left to right. A formation of kk targets moves across the range from left to right, with the same spacing as the marksmen. Hitting target jj adds bjb_j points to a marksman's score.

Initially, target jj is directly in front of marksman jj. Each second, every marksman with a target directly in front of them fires exactly once, and all shots are simultaneous. Every shot hits, and targets remain in the formation after being hit. If marksman nn has fired, the round ends; otherwise, the formation moves one position to the right before the next second.

Formally, let cic_i be the score of marksman ii, initially 00 for every 1≤i≤n1 \le i \le n. For each second i=1,2,…,n−k+1i = 1, 2, \ldots, n - k + 1 in order, the following happens:

ci+j−1←ci+j−1+bjfor every 1≤j≤k.c_{i + j - 1} \gets c_{i + j - 1} + b_j \quad \text{for every } 1 \le j \le k.

Unfortunately, Matt is short-sighted and cannot see the targets. He can only see the final scoreboard a1,a2,…,ana_1, a_2, \ldots, a_n, where aia_i is the score of marksman ii.

Find a possible number of targets kk and their point values b1,b2,…,bkb_1, b_2, \ldots, b_k that produce the given final scoreboard.

If there are several valid formations, output any of them. If none exists, output -1.

Input

The first line contains an integer nn (1≤n≤2×1051 \le n \le 2 \times 10^5), the number of marksmen.

The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (1≤ai≤10181 \le a_i \le 10^{18}), their final scores.

Output

If no valid formation exists, print -1 on a single line.

Otherwise, print an integer kk (1≤k≤n1 \le k \le n), the number of targets, on the first line. On the second line, print kk space-separated integers b1,b2,…,bkb_1, b_2, \ldots, b_k (1≤bj≤10181 \le b_j \le 10^{18}), the targets' point values in their initial left-to-right order.

Example 1

Input 1
3
2 5 3
Output 1
2
2 3
Explanation

The formation has k=2k = 2 targets, worth 22 and 33 points.

  • Second 11: marksman 11 hits target 11 for 22 points, marksman 22 hits target 22 for 33 points. The scoreboard reads [2,3,0][2, 3, 0].
  • Second 22: the formation moves right by one position, so marksman 22 hits target 11 for 22 points and marksman 33 hits target 22 for 33 points. The scoreboard reads [2,5,3][2, 5, 3]. Since the rightmost marksman has hit a target, the round ends.

Example 2

Input 2
5
2 7 10 8 3
Output 2
4
2 5 5 3
Explanation

The formation has k=4k = 4 targets, worth 22, 55, 55 and 33 points.

  • Second 11: the targets are in front of marksmen 11 to 44, and the scoreboard reads [2,5,5,3,0][2, 5, 5, 3, 0].
  • Second 22: the formation has moved right by one position, so the targets are in front of marksmen 22 to 55. After they shoot, the scoreboard reads [2,7,10,8,3][2, 7, 10, 8, 3]. Since the rightmost marksman has hit a target, the round ends.

Another formation that is consistent with this scoreboard is [2,5,3][2, 5, 3], which will also be accepted.

Example 3

Input 3
1
7
Output 3
1
7
Explanation

There is only one marksman, so the formation has one target and the round ends after one shot. The target must be worth exactly 77 points.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.