#include <bits/stdc++.h>
using namespace std;
const int N = 555;
int str[N][N];
int rSum[N][N];
int centerDis[N];
int centerPos[N * 4];
int centerSum[N][N];
int rmaxSum[N][N];
long long rightMaxNum[N][N];
int ans;
long long ansNum;
int main() {
  int m, n, r, i, j, h;
  while (~scanf("%d%d%d", &n, &m, &r)) {
    ans = 0;
    ansNum = 0;
    for (i = 0; i < n; i++) {
      rSum[i][0] = 0;
      for (j = 0; j < m; j++) {
        scanf("%d", &str[i][j]);
        rSum[i][j + 1] = rSum[i][j] + str[i][j];
      }
    }
    centerDis[0] = r;
    for (i = 1; i <= r; i++) {
      for (centerDis[i] = centerDis[i - 1];
           i * i + centerDis[i] * centerDis[i] > r * r; centerDis[i]--)
        ;
    }
    centerPos[0] = 2 * r + 1;
    for (i = 1; i <= 2 * r; i++) {
      centerPos[i] = 0;
      for (h = 1; h <= r; h++) {
        if (h >= i - r && h <= i) {
          centerPos[i] = max(centerPos[i], centerDis[h] + centerDis[i - h] + 1);
        }
      }
    }
    for (i = r; i < n - r; i++) {
      for (j = r; j < m - r; j++) {
        centerSum[i][j] =
            rSum[i][j + centerDis[0] + 1] - rSum[i][j - centerDis[0]];
        for (h = 1; h <= r; h++) {
          centerSum[i][j] +=
              rSum[i + h][j + centerDis[h] + 1] - rSum[i + h][j - centerDis[h]];
          centerSum[i][j] +=
              rSum[i - h][j + centerDis[h] + 1] - rSum[i - h][j - centerDis[h]];
        }
      }
    }
    for (i = r; i < n - r; i++) {
      rmaxSum[i][m - r - 1] = centerSum[i][m - r - 1];
      rightMaxNum[i][m - r - 1] = 1;
      for (j = m - r - 2; j >= r; j--) {
        if (centerSum[i][j] <= rmaxSum[i][j + 1]) {
          rmaxSum[i][j] = rmaxSum[i][j + 1];
          rightMaxNum[i][j] = rightMaxNum[i][j + 1];
          if (centerSum[i][j] == rmaxSum[i][j + 1]) {
            rightMaxNum[i][j]++;
          }
        } else {
          rmaxSum[i][j] = centerSum[i][j];
          rightMaxNum[i][j] = 1;
        }
      }
    }
    for (i = r; i < n - r; i++) {
      for (j = i + 2 * r + 1; j < n - r; j++) {
        if (rmaxSum[i][r] + rmaxSum[j][r] == ans) {
          ansNum += rightMaxNum[i][r] * rightMaxNum[j][r];
        } else if (rmaxSum[i][r] + rmaxSum[j][r] > ans) {
          ans = rmaxSum[i][r] + rmaxSum[j][r];
          ansNum = rightMaxNum[i][r] * rightMaxNum[j][r];
        }
      }
    }
    for (i = r; i < n - r; i++) {
      for (j = r; j < m - r; j++) {
        for (h = 0; h <= 2 * r; h++) {
          if (j + centerPos[h] + r >= m) {
            continue;
          }
          if (i + h < n - r) {
            int score = centerSum[i][j] + rmaxSum[i + h][j + centerPos[h]];
            if (score == ans) {
              ansNum += rightMaxNum[i + h][j + centerPos[h]];
            } else if (score > ans) {
              ans = score;
              ansNum = rightMaxNum[i + h][j + centerPos[h]];
            }
          }
          if (h && i - h >= r) {
            int score = centerSum[i][j] + rmaxSum[i - h][j + centerPos[h]];
            if (score == ans) {
              ansNum += rightMaxNum[i - h][j + centerPos[h]];
            } else if (score > ans) {
              ans = score;
              ansNum = rightMaxNum[i - h][j + centerPos[h]];
            }
          }
        }
      }
    }
    printf("%d %I64d\n", ans, ansNum);
  }
  return 0;
}
