use std::io::Read; fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); let d: usize = iter.next().unwrap().parse().unwrap(); let mut p: Vec = iter.map(|n| n.parse::().unwrap()).collect(); for i in (3..=d).rev() { p[i-2] += p[i]; p[i] = 0; } for i in (0..=3).rev() { if p[i] != 0 { println!("{}", i); for j in 0..i { print!("{} ", p[j]); } println!("{}", p[i]); return; } } println!("0\n0"); }