#include <bits/stdc++.h>
using namespace std;
int pictureTime[50001];
int ti[5][50001];
int main() {
  int n, m;
  cin >> m >> n;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> ti[j][i];
    }
  }
  for (int i = 0; i < n; i++) {
    int start = 0;
    for (int j = 0; j < m; j++) {
      pictureTime[j] = ti[i][j] + max(start, pictureTime[j]);
      start = pictureTime[j];
    }
  }
  for (int i = 0; i < m; i++) cout << pictureTime[i] << " ";
}
