#include #include char *p1,*p2,buf[1 << 20]; #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1 << 20,stdin),p1==p2)?EOF:*p1++) inline uint32_t read(){ uint32_t x = 0; char c = gc(); while(c < 48) c = gc(); while(c > 47) x = x * 10 + (c & 15), c = gc(); return x; } size_t outpos = 0; inline void pc(char c){ if(outpos == sizeof(buf)){ fwrite(buf, 1, outpos, stdout); outpos = 0; } buf[outpos++] = c; } inline void write(uint32_t x){ char s[10]; int n = 0; do { s[n++] = '0' + x % 10; x /= 10; } while(x); while(n) pc(s[--n]); pc('\n'); } int main(){ uint32_t h = read(), w = read(), tot = 0; uint32_t S[h]; for(uint32_t y = 0; y < h; y++){ S[y] = read(); for(uint32_t x = 1; x < w; x++) S[y] += read(); tot += S[y]; } for(uint32_t i = 0; i < h; i++) write(tot + S[i]); fwrite(buf, 1, outpos, stdout); }