import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int D = sc.nextInt(); int[] as = new int[D + 1]; for(int i = 0; i <= D; i++){ as[i] = sc.nextInt(); } int[] bs = {0, -1, 0, 1}; //System.out.println(Arrays.toString(as)); for(int i = D - (bs.length - 1); i >= 0; i--){ final int pow = as[i + bs.length - 1] / bs[bs.length - 1]; for(int j = bs.length - 1; j >= 0; j--){ as[i + j] -= pow * bs[j]; } //System.out.println(Arrays.toString(as)); } boolean div_ok = true; int non_zero = 0; for(int i = D; i >= 0; i--){ if(as[i] != 0){ non_zero = i; div_ok = false; break; } } if(div_ok){ System.out.println(0); System.out.println(0); }else{ System.out.println(non_zero); for(int i = 0; i <= non_zero; i++){ if(i != 0){ System.out.print(" "); } System.out.print(as[i]); } System.out.println(); } } }