#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5 + 113;
const long long MOD = 1e9 + 7;
int n, m;
long long tab[50000][13];
long long paint[N], pict[N];
int main() {
  cin >> m >> n;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> tab[i][j];
      int start = max(paint[j], pict[i]);
      start += tab[i][j];
      paint[j] = start;
      pict[i] = start;
    }
  }
  for (int i = 1; i <= m; i++) cout << pict[i] << ' ';
  return 0;
}
