#include <bits/stdc++.h>
using namespace std;
long long ar[1000005][7], dp[1000006];
int main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) cin >> ar[i][j];
  }
  for (long long i = 1; i <= m; i++) {
    long long sum = 0;
    for (long long j = 1; j <= n; j++) {
      sum = max(sum, dp[j]) + ar[j][i];
      dp[j] = sum;
    }
  }
  for (int i = 1; i <= n; i++) cout << dp[i] << ' ';
}
