#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  long long A[n + 1][m + 1];
  long long su[n + 1][m + 1];
  memset(su, 0, sizeof(su));
  long long re = 0, sc = 0;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> A[i][j];
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= n; j++) {
      su[j][i] = su[j - 1][i] + A[j][i];
    }
  }
  for (long long i = 1; i <= m; i++) {
    long long aaro = 0;
    long long aare = 0;
    for (long long j = 1; j <= n; j++) {
      if (A[j][i] == 1) {
        long long ons = 0;
        for (long long oo = j, cnt = 0; cnt < min(k, n - j + 1); oo++, cnt++) {
          if (A[oo][i] == 1) ons++;
        }
        if (ons > aaro) {
          aaro = ons;
          long long z = 0;
          aare = max(su[j][i] - 1, z);
        }
      }
    }
    sc += aaro;
    re += aare;
  }
  cout << sc << " " << re;
  return 0;
}
