use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let v: Vec = s.split_whitespace().flat_map(str::parse).collect(); let (mut a, mut x) = (0, 0); for i in 2..v.len() { print!("{a} "); x += v[i]; a = x.max(a + v[1]); } println!("{}", a); }