#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  long long int arr[m];
  memset(arr, 0, sizeof(arr));
  long long int delay = 0;
  int x;
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < m; i++) {
      cin >> x;
      if (i == 0)
        arr[i] += x;
      else if (arr[i - 1] - arr[i] > 0)
        arr[i] += (arr[i - 1] - arr[i]) + x;
      else
        arr[i] += x;
    }
    cout << arr[m - 1] << endl;
  }
  return 0;
}
