#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[50003][6] = {0};
  int n, m;
  cin >> m;
  cin >> n;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
      a[i][j] = max(a[i][j - 1], a[i - 1][j]) + a[i][j];
    }
  }
  for (int i = 1; i <= m; i++) {
    cout << a[i][n] << " ";
  }
  return 0;
}
