#include using namespace std; unsigned h, w, a, s[1000000], t, i, j; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> h >> w; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { cin >> a; s[i] += a; } t += s[i]; } for (i = 0; i < h; i++) { s[i] += t; cout << s[i]<< '\n'; } }