use std::io::{self, Read, Write, BufWriter}; fn main() { let mut buffer = String::new(); io::stdin().lock().read_to_string(&mut buffer).unwrap(); let mut iter = buffer.split_whitespace(); let h: usize = iter.next().unwrap().parse().unwrap(); let w: usize = iter.next().unwrap().parse().unwrap(); let mut c = vec![0u32; h]; let mut s = 0u32; for i in 0..h { let mut x = 0u32; for _ in 0..w { let a: u32 = iter.next().unwrap().parse().unwrap(); x = x.wrapping_add(a); } c[i] = x; s = s.wrapping_add(x); } let stdout = io::stdout(); let mut writer = BufWriter::new(stdout.lock()); for i in 0..h { let val = s.wrapping_add(c[i]); writeln!(writer, "{}", val).unwrap(); } }