#include <bits/stdc++.h>
using namespace std;
const int M = 500 + 10;
int a[M][M];
int pre[M][M];
int numinrow[M];
int rsum[M][M];
int premax[M][M];
int prenum[M][M];
int sufmax[M][M];
int sufnum[M][M];
int dis[2 * M];
int main() {
  time_t t_start, t_end;
  t_start = clock();
  int n, m;
  cin >> n >> m;
  int r;
  cin >> r;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int row = 1; row <= n; row++) {
    for (int col = 1; col <= m; col++) {
      pre[row][col] = pre[row][col - 1] + a[row][col];
    }
  }
  for (int drow = 0; drow <= r; drow++) {
    int res = r * r - drow * drow;
    for (int i = 0; i * i <= res; i++) {
      numinrow[drow] = i;
    }
  }
  for (int row = r + 1; row <= n - r; row++) {
    for (int col = r + 1; col <= m - r; col++) {
      for (int drow = 0; drow <= r; drow++) {
        int nxtrow = row + drow;
        int leftidx = col - numinrow[drow];
        int rightidx = col + numinrow[drow];
        int val = pre[nxtrow][rightidx] - pre[nxtrow][leftidx - 1];
        rsum[row][col] += val;
        if (drow > 0) {
          nxtrow = row - drow;
          val = pre[nxtrow][rightidx] - pre[nxtrow][leftidx - 1];
          rsum[row][col] += val;
        }
      }
    }
  }
  for (int row = r + 1; row <= n - r; row++) {
    for (int col = r + 1; col <= m - r; col++) {
      if (rsum[row][col] > premax[row][col - 1]) {
        premax[row][col] = rsum[row][col];
        prenum[row][col] = 1;
      } else {
        if (rsum[row][col] == premax[row][col - 1]) {
          premax[row][col] = premax[row][col - 1];
          prenum[row][col] = prenum[row][col - 1] + 1;
        } else {
          premax[row][col] = premax[row][col - 1];
          prenum[row][col] = prenum[row][col - 1];
        }
      }
    }
  }
  for (int row = r + 1; row <= n - r; row++) {
    for (int col = m - r; col >= r + 1; col--) {
      if (rsum[row][col] > sufmax[row][col + 1]) {
        sufmax[row][col] = rsum[row][col];
        sufnum[row][col] = 1;
      } else {
        if (rsum[row][col] == sufmax[row][col + 1]) {
          sufmax[row][col] = sufmax[row][col + 1];
          sufnum[row][col] = sufnum[row][col + 1] + 1;
        } else {
          sufmax[row][col] = sufmax[row][col + 1];
          sufnum[row][col] = sufnum[row][col + 1];
        }
      }
    }
  }
  for (int d = 0; d <= 2 * r; d++) {
    for (int i = 0; i <= r; i++) {
      int x = i;
      int y = i + d;
      if (y <= r) {
        int numy = numinrow[y];
        int numx = numinrow[x];
        dis[d] = max(dis[d], numx + numy);
      }
      x = -i;
      y = -i + d;
      x = abs(x);
      y = abs(y);
      if (y <= r) {
        int numy = numinrow[y];
        int numx = numinrow[x];
        dis[d] = max(dis[d], numx + numy);
      }
    }
  }
  int ans = 0;
  long long int cnt = 0;
  for (int row = r + 1; row <= n - r; row++) {
    for (int col = r + 1; col <= m - r; col++) {
      int v1 = rsum[row][col];
      for (int i = r + 1; i <= n - r; i++) {
        int d = abs(i - row);
        int val = dis[d] + 1;
        if (d - 1 >= 2 * r) {
          if (premax[i][m - r] + v1 > ans) {
            ans = premax[i][m - r] + v1;
            cnt = prenum[i][m - r];
          } else {
            if (premax[i][m - r] + v1 == ans) {
              cnt += prenum[i][m - r];
            }
          }
        } else {
          int leftidx = col - val;
          int rightidx = col + val;
          if (leftidx >= r + 1) {
            if (premax[i][leftidx] + v1 > ans) {
              ans = premax[i][leftidx] + v1;
              cnt = prenum[i][leftidx];
            } else {
              if (premax[i][leftidx] + v1 == ans) {
                cnt += prenum[i][leftidx];
              }
            }
          }
          if (rightidx <= m - r) {
            if (sufmax[i][rightidx] + v1 > ans) {
              ans = sufmax[i][rightidx] + v1;
              cnt = sufnum[i][rightidx];
            } else {
              if (sufmax[i][rightidx] + v1 == ans) {
                cnt += sufnum[i][rightidx];
              }
            }
          }
        }
      }
    }
  }
  cout << ans << " " << cnt / 2 << endl;
  t_end = clock();
  return 0;
}
