#include <bits/stdc++.h>
using namespace std;
int grid[500][500];
int srow[500][500];
int scircle[500][500];
int rmaxcircle[500][500 + 1];
int cmaxcircle[500][500 + 1];
int width[((500 - 1) / 2) + 1];
int separation[2 * ((500 - 1) / 2) + 1];
int partial_row_sum(int row, int left, int right) {
  return srow[row][right + 1] - srow[row][left];
}
long long mul_ll(long long x, long long y) { return x * y; }
int solve_problem() {
  int n, m, r;
  if (scanf("%d %d %d", &n, &m, &r) != 3) return 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (scanf("%d", &grid[i][j]) != 1) return 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) srow[i][j + 1] = srow[i][j] + grid[i][j];
  width[0] = r;
  for (int i = 1; i <= r; i++) {
    int w = width[i - 1];
    while (i * i + w * w > r * r) --w;
    width[i] = w;
  }
  for (int i = 0; i <= 2 * r; i++) {
    int limit = min(i / 2, r);
    for (int j = max(0, i - r); j <= limit; j++) {
      int cand = width[j] + width[i - j] + 1;
      if (cand > separation[i]) separation[i] = cand;
    }
  }
  for (int i = r; i < n - r; i++)
    for (int j = r; j < m - r; j++)
      for (int k = 0; k <= r; k++) {
        scircle[i][j] += partial_row_sum(i + k, j - width[k], j + width[k]);
        if (k > 0)
          scircle[i][j] += partial_row_sum(i - k, j - width[k], j + width[k]);
      }
  for (int i = r; i < n - r; i++)
    for (int j = m - r - 1; j >= r; j--)
      if (scircle[i][j] <= rmaxcircle[i][j + 1]) {
        rmaxcircle[i][j] = rmaxcircle[i][j + 1];
        cmaxcircle[i][j] = cmaxcircle[i][j + 1];
        if (rmaxcircle[i][j] == scircle[i][j]) ++cmaxcircle[i][j];
      } else {
        rmaxcircle[i][j] = scircle[i][j];
        cmaxcircle[i][j] = 1;
      }
  int result = 0;
  long long mult = 0;
  for (int i = r; i < n - r; i++)
    for (int j = i + 2 * r + 1; j < n - r; j++) {
      int cand = rmaxcircle[i][r] + rmaxcircle[j][r];
      if (cand > result) {
        result = cand;
        mult = mul_ll(cmaxcircle[i][r], cmaxcircle[j][r]);
      } else if (cand == result) {
        mult += mul_ll(cmaxcircle[i][r], cmaxcircle[j][r]);
      }
    }
  for (int i = r; i < n - r; i++)
    for (int j = r; j < m - r; j++)
      for (int k = max(i - 2 * r, r); k < min(i + 2 * r + 1, n - r); k++) {
        int delta = k - i;
        if (delta < 0) delta = -delta;
        int l = j + separation[delta];
        if (l < m - r) {
          int cand = scircle[i][j] + rmaxcircle[k][l];
          if (cand > result) {
            result = cand;
            mult = cmaxcircle[k][l];
          } else if (cand == result) {
            mult += cmaxcircle[k][l];
          }
        }
      }
  cout << result << ' ' << mult << endl;
  return 0;
}
int main() {
  solve_problem();
  return 0;
}
