#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAXN = 5002;
const int MOD = 998244353;
const double eps = 1e-8;
const double PI = acos(-1.0);
int ma[105][105];
int n, m, k;
long long ans;
long long ans2;
void solve() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (ma[i][j] == 1) {
        for (int p = i + 1; p < i + k && p <= n; p++) {
          if (ma[p][j] == 1) ma[i][j]++;
        }
      }
    }
  }
}
void solve2() {
  int t;
  int res;
  int mm;
  for (int j = 1; j <= m; j++) {
    t = 0;
    mm = 0;
    res = 0;
    for (int i = 1; i <= n; i++) {
      if (ma[i][j] > mm) {
        mm = ma[i][j];
        res = t;
      }
      if (ma[i][j] > 0) t++;
    }
    ans += mm;
    ans2 += res;
  }
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    ans = 0;
    ans2 = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        scanf("%d", &ma[i][j]);
      }
    }
    solve();
    solve2();
    printf("%lld %lld\n", ans, ans2);
  }
}
