#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int MOD = 1000000007;
const int N = 505;
int n, m, r, a[N][N], l[N][N], num[N][N];
int dif[N], Left_Max[N][N], Left_Cnt[N][N], Right_Max[N][N], Right_Cnt[N][N];
long long update(long long &a, long long &b, long long c, long long d) {
  if (c > a) {
    a = c;
    b = d;
  } else if (c == a) {
    b += d;
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &r);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
      l[i][j] = l[i][j - 1] + a[i][j];
    }
  }
  for (int i = r + 1; i <= n - r; i++) {
    for (int j = r + 1; j <= m - r; j++) {
      num[i][j] = 0;
      for (int k = -r; k <= r; k++) {
        int len = sqrt(r * r - k * k);
        num[i][j] += l[i - k][j + len] - l[i - k][j - len - 1];
      }
    }
  }
  for (int i = r + 1; i <= n - r; i++) {
    for (int j = r + 1; j <= m - r; j++) {
      if (num[i][j] > Left_Max[i][j - 1]) {
        Left_Max[i][j] = num[i][j];
        Left_Cnt[i][j]++;
      } else if (num[i][j] == Left_Max[i][j - 1]) {
        Left_Max[i][j] = Left_Max[i][j - 1];
        Left_Cnt[i][j] = Left_Cnt[i][j - 1] + 1;
      } else {
        Left_Max[i][j] = Left_Max[i][j - 1];
        Left_Cnt[i][j] = Left_Cnt[i][j - 1];
      }
    }
  }
  for (int i = r + 1; i <= n - r; i++) {
    for (int j = m - r; j >= r + 1; j--) {
      if (num[i][j] > Right_Max[i][j + 1]) {
        Right_Max[i][j] = num[i][j];
        Right_Cnt[i][j]++;
      } else if (num[i][j] == Right_Max[i][j + 1]) {
        Right_Max[i][j] = Right_Max[i][j + 1];
        Right_Cnt[i][j] = Right_Cnt[i][j + 1] + 1;
      } else {
        Right_Max[i][j] = Right_Max[i][j + 1];
        Right_Cnt[i][j] = Right_Cnt[i][j + 1];
      }
    }
  }
  for (int i = 0; i <= 2 * r; i++) {
    int mindif = 0;
    for (int j = 0; j <= r; j++) {
      mindif =
          max(mindif, ((int)sqrt(r * r - (j) * (j))) + 1 +
                          ((int)sqrt(r * r - (abs(i - j)) * (abs(i - j)))));
    }
    dif[i] = mindif;
  }
  long long ans = 0, ret = 0;
  for (int i = r + 1; i <= n - r; i++) {
    for (int j = r + 1; j <= m - r; j++) {
      for (int k = r + 1; k <= n - r; k++) {
        if (abs(k - i) > 2 * r) {
          long long val = num[i][j] + Left_Max[k][m - r],
                    cnt = Left_Cnt[k][m - r];
          update(ans, ret, val, cnt);
        } else {
          int Left = j - dif[abs(k - i)], Right = j + dif[abs(k - i)];
          long long val = num[i][j] + Left_Max[k][Left],
                    cnt = Left_Cnt[k][Left];
          update(ans, ret, val, cnt);
          val = num[i][j] + Right_Max[k][Right], cnt = Right_Cnt[k][Right];
          update(ans, ret, val, cnt);
        }
      }
    }
  }
  if (ret / 2 == 0) ans = 0;
  printf("%I64d %I64d\n", ans, ret / 2);
  return 0;
}
