#include <bits/stdc++.h>
using namespace std;
const int INF = 20000005;
const long long INFLL = 1000000000000000002ll;
const long long MOD = 1000000007;
inline long long min(long long a, long long b, long long c) {
  return min(min(a, b), c);
}
inline long long min(long long a, long long b, long long c, long long d) {
  return min(min(min(a, b), c), d);
}
inline long long max(long long a, long long b, long long c) {
  return max(max(a, b), c);
}
inline long long max(long long a, long long b, long long c, long long d) {
  return max(max(max(a, b), c), d);
}
int A[105][105], Col[105][105], DP[105][10105], H, W, K;
int main() {
  cin >> H >> W >> K;
  for (int i = (0); i <= (100); i++)
    for (int j = (0); j <= (100); j++) Col[i][j] = INF;
  for (int i = (0); i <= (100); i++) Col[i][0] = 0;
  for (int i = (1); i <= (H); i++)
    for (int j = (1); j <= (W); j++) scanf("%d", &A[i][j]);
  for (int j = (1); j <= (W); j++) {
    int cnt = 0;
    for (int i = (1); i <= (H); i++)
      if (A[i][j] == 1) {
        int score = 0;
        for (int t = (i); t <= (min(i + K - 1, H)); t++) score += A[t][j];
        Col[j][score] = min(Col[j][score], cnt);
        cnt++;
      }
  }
  for (int j = (0); j <= (100); j++)
    for (int s = (0); s <= (10000); s++) DP[j][s] = INF;
  DP[0][0] = 0;
  for (int j = (0); j <= (W - 1); j++)
    for (int s = (0); s <= (10000); s++)
      for (int now = (0); now <= (100); now++)
        DP[j + 1][s + now] =
            min(DP[j + 1][s + now], DP[j][s] + Col[j + 1][now]);
  for (int s = (10000); s >= (0); s--)
    if (DP[W][s] < INF) {
      cout << s << " " << DP[W][s];
      return 0;
    }
}
