#include <bits/stdc++.h>
int n, m, r;
int a[600][600];
int c[600][600];
int cr[600][2];
int tc[2000][2000];
int tcr[2000][2];
int s[600][600];
int lmax[600][600];
long long lmaxi[600][600];
int rmax[600][600];
long long rmaxi[600][600];
int isgyup(int x, int y, int rx, int ry) {
  int dx = (x + rx) / 2, dy = (y + ry) / 2;
  int i, j;
  for (i = dx - 10; i <= dx + 10; i++) {
    for (j = dy - 10; j <= dy + 10; j++) {
      if ((i - x) * (i - x) + (j - y) * (j - y) <= r * r &&
          (i - rx) * (i - rx) + (j - ry) * (j - ry) <= r * r) {
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  int i, j, k;
  scanf("%d%d%d", &n, &m, &r);
  if (n < 2 * r + 1 || m < 2 * r + 1) {
    printf("0 0\n");
    return 0;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if ((i - r) * (i - r) + (j - r) * (j - r) <= r * r) c[i][j] = 1;
    }
  }
  for (i = 0; i < n; i++) cr[i][0] = cr[i][1] = -1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (c[i][j] && cr[i][0] == -1) cr[i][0] = j, cr[i][1] = -2;
      if (!c[i][j] && cr[i][1] == -2) cr[i][1] = j - 1;
    }
  }
  for (i = 0; i <= r * 5 + 2; i++) {
    for (j = 0; j <= r * 5 + 2; j++) {
      if (isgyup(i, j, 2 * r + 1, 2 * r + 1)) tc[i][j] = 1;
    }
  }
  for (i = 0; i < 2000; i++) tcr[i][0] = tcr[i][1] = -1;
  for (i = 0; i <= r * 5 + 2; i++) {
    for (j = 0; j <= r * 5 + 2; j++) {
      if (tc[i][j] && tcr[i][0] == -1) tcr[i][0] = j, tcr[i][1] = -2;
      if (!tc[i][j] && tcr[i][1] == -2) tcr[i][1] = j - 1;
    }
  }
  for (i = r; i < n - r; i++) {
    for (j = 0; j < n; j++) {
      for (k = 0; k < m; k++) {
        if (c[j][k]) s[i][r] += a[i - r + j][k];
      }
    }
    for (j = r + 1; j < m - r; j++) {
      s[i][j] = s[i][j - 1];
      for (k = 0; k < n; k++) {
        if (cr[k][0] == -1) break;
        s[i][j] += a[i - r + k][j + cr[k][1] - r];
        s[i][j] -= a[i - r + k][j - 1 + cr[k][0] - r];
      }
    }
  }
  for (i = r; i < n - r; i++) {
    lmax[i][r] = s[i][r];
    lmaxi[i][r] = 1;
    for (j = r + 1; j < m - r; j++) {
      lmax[i][j] = lmax[i][j - 1];
      lmaxi[i][j] = lmaxi[i][j - 1];
      if (lmax[i][j] < s[i][j])
        lmax[i][j] = s[i][j], lmaxi[i][j] = 1;
      else if (lmax[i][j] == s[i][j])
        lmaxi[i][j]++;
    }
    rmax[i][m - r - 1] = s[i][m - r - 1];
    rmaxi[i][m - r - 1] = 1;
    for (j = m - r - 2; j >= r; j--) {
      rmax[i][j] = rmax[i][j + 1];
      rmaxi[i][j] = rmaxi[i][j + 1];
      if (rmax[i][j] < s[i][j])
        rmax[i][j] = s[i][j], rmaxi[i][j] = 1;
      else if (rmax[i][j] == s[i][j])
        rmaxi[i][j]++;
    }
  }
  int maxx = 0;
  long long maxxi = 0;
  for (i = r; i < n - r; i++) {
    for (j = r; j < m - r; j++) {
      int max = -1;
      long long maxi = 1;
      for (k = r; k < n - r; k++) {
        if (k - i + 2 * r + 1 < 0 || tcr[k - i + 2 * r + 1][0] == -1) {
          if (max < lmax[k][m - r - 1])
            max = lmax[k][m - r - 1], maxi = lmaxi[k][m - r - 1];
          else if (max == lmax[k][m - r - 1])
            maxi += lmaxi[k][m - r - 1];
          continue;
        }
        int L, R;
        L = tcr[k - i + 2 * r + 1][0] - 1 - 2 * r - 1 + j;
        R = tcr[k - i + 2 * r + 1][1] + 1 - 2 * r - 1 + j;
        if (L >= r && L < m - r && max < lmax[k][L])
          max = lmax[k][L], maxi = lmaxi[k][L];
        else if (L >= r && L < m - r && max == lmax[k][L])
          maxi += lmaxi[k][L];
        if (R < m - r && R >= r && max < rmax[k][R])
          max = rmax[k][R], maxi = rmaxi[k][R];
        else if (R < m - r && R >= r && max == rmax[k][R])
          maxi += rmaxi[k][R];
      }
      if (max == -1) continue;
      if (maxx < s[i][j] + max) {
        maxx = s[i][j] + max;
        maxxi = maxi;
      } else if (maxx == s[i][j] + max) {
        maxxi += maxi;
      }
    }
  }
  printf("%d %I64d", maxx, maxxi / 2);
  return 0;
}
