#pragma GCC target("prefer-vector-width=512") #pragma GCC optimize("Ofast") #include #include #include namespace fastio { using namespace std; static char* p; void init() { struct stat st; fstat(0, &st); p = (char*)mmap(0, st.st_size, PROT_READ, MAP_SHARED, 0, 0); } template inline void rd(T& x) { x = 0; while (*p < '0' || *p > '9') p++; while (*p >= '0' && *p <= '9') { x = x * 10 + (*p - '0'); p++; } } static char outbuf[1 << 20]; int out_p = 0; inline void flush() { if (out_p) fwrite(outbuf, 1, out_p, stdout); out_p = 0; } inline void put(char c) { if (out_p == 1 << 20) flush(); outbuf[out_p++] = c; } template inline void wt(T x) { if (x == 0) { if (out_p == 1 << 20) flush(); outbuf[out_p++] = '0'; return; } static char s[12]; int i = 0; while (x) { s[i++] = x % 10 + '0'; x /= 10; } while (i--) { if (out_p == 1 << 20) flush(); outbuf[out_p++] = s[i]; } } struct D { ~D() { flush(); } } d; } // namespace fastio using fastio::put; using fastio::rd; using fastio::wt; // using namespace std; using ll = long long; #define rep(i, s, t) for (int i = s; i < (int)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } using u32 = uint32_t; std::array a; std::array s; int main() { u32 t = 0; u32 h, w; rd(h); rd(w); // std::cin >> h >> w; rep(i, 0, h * w) rd(a[i]); // rep(i, 0, h * w) std::cin >> a[i]; rep(i, 0, h) rep(j, 0, w) s[i] += a[i * w + j]; rep(i, 0, h) t += s[i]; rep(i, 0, h) { wt(s[i] + t); put('\n'); // std::cout << (s[i] + t) << '\n'; } }