use std::io::{self, Read, Write}; fn main(){ let mut input=Vec::new();io::stdin().read_to_end(&mut input).unwrap();let mut it=input.split(|b|b.is_ascii_whitespace()); let h:usize=std::str::from_utf8(it.next().unwrap()).unwrap().parse().unwrap();let w:usize=std::str::from_utf8(it.next().unwrap()).unwrap().parse().unwrap(); let mut sums=vec![0u32;h];let mut total=0u32; for s in &mut sums{for _ in 0..w{let x:u32=std::str::from_utf8(it.next().unwrap()).unwrap().parse().unwrap();*s=s.wrapping_add(x);}total=total.wrapping_add(*s);} let stdout=io::stdout();let mut out=io::BufWriter::with_capacity(1<<20,stdout.lock());for s in sums{writeln!(out,"{}",s.wrapping_add(total)).unwrap();} }