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