#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 2e9;
const long long INF64 = 3e18;
const long double EPS = 1e-12;
const long double PI = 3.1415926535897932384626433832795028841;
const long long MD = 925262732;
const long long T = 634521;
const int N = 200100;
const int M = 2001;
long long n, m, a[N][6], ans[N];
int main() {
  cin >> n >> m;
  for (int i = 0; i < int(n); i++)
    for (int j = 0; j < int(m); j++) scanf("%d", &a[i][j]);
  for (int i = 0; i < int(n); i++) {
    if (i == 0)
      ans[i] = a[i][0];
    else
      ans[i] = ans[i - 1] + a[i][0];
  }
  for (int j = 1; j < m; j++) {
    for (int i = 0; i < int(n); i++) {
      if (i == 0)
        ans[i] += a[i][j];
      else {
        ans[i] = max(ans[i - 1], ans[i]) + a[i][j];
      }
    }
  }
  for (int i = 0; i < int(n); i++) printf("%I64d ", ans[i]);
  return 0;
}
