#include #include #include #define int ptrdiff_t #define div lldiv #define div_t lldiv_t #define abs(a) ((a)<0?-(a):(a)) #define min(a,b) ((a)<(b)?(a):(b)) int D; int a[100000]; int b[4] = {0, -1, 0, 1}; main(void) { int i,j; scanf("%td", &D); for (i = 0; i <= D; i++) scanf("%td", &a[i]); for (i = D; i >= 3; i--) { int t = a[i] / b[3]; for (j = 3; j >= 0; j--) a[i-3+j] -= t * b[j]; } for (i = 2; i >= 1; i--) if (a[i] != 0) break; printf("%td\n", i); for (j = 0; j <= i; j++) printf("%td ", a[j]); printf("\n"); return 0; }