#include using namespace std; #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } #define REP(i, a) for(int i = 0; i < a; i++) #define scan(x) cin >> x #define print(x) cout << x << "\n" int main() { fastcin; int d; scan(d); int a[d+1]; REP(i, d+1) scan(a[i]); if (d < 3) { } else { int b[d-2]; for (int i = d-4; i >= -1; --i) { b[i+1] = a[i+4]; a[i+2] += b[i+1]; } if (a[2] != 0) d = 2; else if (a[1] != 0) d = 1; else d = 0; } print(d); REP(i, d+1) cout << a[i] << ' '; return 0; }