#[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),*); }; } #[fastout] fn main() { input! {h:usize,w:usize,a:[[u32;w];h]} let mut t: u32 = 0; for i in 0..h { for j in 0..w { t = t.wrapping_add(a[i][j]); } } for i in 0..h { let mut ans = t; for j in 0..w { ans = ans.wrapping_add(a[i][j]); } println!("{}", ans); } }