#include "iostream" using namespace std; int N; long long int num[200000]; long long int ans[200001]; long long int MIN=0; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> num[i]; } ans[0] = 1; for (int i = 1; i < N + 1; i++) { if (i % 2 == 1) { ans[i] = num[i - 1] - ans[i - 1]; } else { ans[i] = ans[i - 1] - num[i - 1]; } if (ans[i] <= 0) { if (((i + 1) / 2) % 2 == 1) { if (ans[i] - 1 < MIN)MIN = ans[i] ; } else { cout << "-1\n"; return 0; } } } if (MIN < 0) { ans[0] -= MIN; ans[0]++; } if (ans[0] <= 0) { cout << "-1\n"; return 0; } for (int i = 1; i < N + 1; i++) { if (i % 2 == 1) { ans[i] = num[i - 1] - ans[i - 1]; } else { ans[i] = ans[i - 1] - num[i - 1]; } if (ans[i] <= 0) { cout << "-1\n"; return 0; } } cout << N + 1 << "\n"; for (int i = 0; i < N + 1; i++) { cout << ans[i] << "\n"; } return 0; }