#[allow(unused_imports)] use { ac_library::{ModInt as Mint, *}, itertools::{iproduct, Itertools}, proconio::{fastout, input, marker::*}, std::collections::*, }; #[allow(unused_macros)] macro_rules! debug { ($($a:expr),* $(,)*) => { #[cfg(debug_assertions)] eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*); }; } use std::io::{BufWriter, Write}; fn main() { input! {h:usize,w:usize,a:[[u32;w];h]} let mut s = vec![0u32; h]; for i in 0..h { for j in 0..w { s[i] = s[i].wrapping_add(a[i][j]); } } let t: u32 = s.iter().copied().reduce(|x, y| x.wrapping_add(y)).unwrap(); let stdout = std::io::stdout(); let mut out = BufWriter::new(stdout.lock()); for i in 0..h { writeln!(out, "{}", t.wrapping_add(s[i])).unwrap(); } }