#include #define rep(i, n) for(long long i = 0; i < n; i++) #define ALL(v) (v).begin(), (v).end() using namespace std; using lint = long long; int main() { int d; cin >> d; vector a(d + 1); rep(i, d + 1) { cin >> a[i]; } for (int i = d; i >= 3; i--) { int q = a[i]; a[i] -= q; a[i - 2] += q; } int right = -1; rep(i, d + 1) { if (a[i] != 0) { right = i; } } if (right == -1) { cout << 0 << endl << 0 << endl; } else { cout << right << endl; rep(i, right + 1) { cout << a[i] << " "; } cout << endl; } }