#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<vector<int> > time(n, vector<int>(m, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &time[i][j]);
  vector<int> ans(n, 0);
  for (int i = 0; i < m; i++) {
    int b = 0;
    for (int j = 0; j < n; j++) {
      int start = max(ans[j], b);
      ans[j] = start + time[j][i];
      b = ans[j];
    };
  };
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  cin.get();
  cin.get();
  return 0;
}
