#include <bits/stdc++.h>
using namespace std;
int x[101][101];
int cum[101];
int m, n, k;
map<int, int> mp;
int fin1, fin2;
void check(int j) {
  mp.clear();
  for (int i = 1; i <= n; ++i) {
    if (x[i][j] == 1)
      cum[i] = cum[i - 1] + 1;
    else
      cum[i] = cum[i - 1];
  }
  int frq = 0;
  for (int i = 1; i <= n; ++i) {
    while (i <= n && x[i][j] != 1) i++;
    if (!x[i][j]) break;
    int pos = i + (min(n - i + 1, k) - 1);
    int number = cum[pos] - cum[i - 1];
    if (mp.find(number) == mp.end()) mp[number] = frq;
    frq++;
  }
  if (!mp.empty()) {
    auto it = --mp.end();
    fin1 += it->first;
    fin2 += it->second;
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) cin >> x[i][j];
  }
  for (int j = 1; j <= m; ++j) {
    check(j);
  }
  cout << fin1 << " " << fin2 << endl;
  return 0;
}
