#include <bits/stdc++.h>
using namespace std;
int suml[510][510], sum[510][510], maxl[510][510], maxr[510][510],
    cntl[510][510], cntr[510][510];
int a[510][510], dis[510];
int main() {
  int n, m, r;
  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]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) suml[i][j] = suml[i][j - 1] + a[i][j];
  }
  for (int i = r + 1; i + r <= n; i++) {
    for (int j = r + 1; j + r <= m; j++) {
      sum[i][j] = 0;
      for (int dx = -r; dx <= r; dx++) {
        int dy = (int)(sqrt(r * 1.0 * r - dx * 1.0 * dx) + 1e-8);
        sum[i][j] += suml[i + dx][j + dy] - suml[i + dx][j - dy - 1];
      }
    }
    for (int j = r + 1; j + r <= m; j++) {
      maxl[i][j] = max(maxl[i][j - 1], sum[i][j]);
      if (maxl[i][j] > maxl[i][j - 1])
        cntl[i][j] = 1;
      else if (sum[i][j] == maxl[i][j])
        cntl[i][j] = cntl[i][j - 1] + 1;
      else
        cntl[i][j] = cntl[i][j - 1];
    }
    for (int j = m - r; j >= r + 1; j--) {
      maxr[i][j] = max(maxr[i][j + 1], sum[i][j]);
      if (maxr[i][j] > maxr[i][j + 1])
        cntr[i][j] = 1;
      else if (sum[i][j] == maxr[i][j])
        cntr[i][j] = cntr[i][j + 1] + 1;
      else
        cntr[i][j] = cntr[i][j + 1];
    }
  }
  for (int i = 0; i <= n; i++) {
    dis[i] = -1;
    for (int j = 0; j <= m; j++) {
      bool ok = true;
      for (int k = 0; k <= j; k++) {
        int dx1 = k, dx2 = j - k;
        if (dx1 > r || dx2 > r) continue;
        int dy1 = (int)(sqrt(r * 1.0 * r - dx1 * 1.0 * dx1) + 1e-8),
            dy2 = (int)(sqrt(r * 1.0 * r - dx2 * 1.0 * dx2) + 1e-8);
        if (dy1 + dy2 + 1 > i) ok = false;
      }
      if (ok) {
        dis[i] = j;
        break;
      }
    }
  }
  int val = 0;
  long long num = 0;
  for (int i = r + 1; i + r <= n; i++)
    for (int j = r + 1; j + r <= m; j++) {
      for (int k = i; k + r <= n; k++) {
        if (dis[k - i] == -1) continue;
        int L = j - dis[k - i], R = j + dis[k - i];
        if (L == R) R++;
        if (k - i == 0) {
          if (L >= r + 1) {
            int tmp = sum[i][j] + maxl[k][L];
            if (tmp == val)
              num += cntl[k][L];
            else if (tmp > val) {
              val = tmp;
              num = cntl[k][L];
            }
          }
        } else {
          if (L >= r + 1) {
            int tmp = sum[i][j] + maxl[k][L];
            if (tmp == val)
              num += cntl[k][L];
            else if (tmp > val) {
              val = tmp;
              num = cntl[k][L];
            }
          }
          if (R <= m - r) {
            int tmp = sum[i][j] + maxr[k][R];
            if (tmp == val)
              num += cntr[k][R];
            else if (tmp > val) {
              val = tmp;
              num = cntr[k][R];
            }
          }
        }
      }
    }
  printf("%d %I64d\n", val, num);
  return 0;
}
