#include <bits/stdc++.h>
using namespace std;
inline int read() {
  static int r, sign;
  static char c;
  r = 0, c = getchar(), sign = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') sign = -1, c = getchar();
  while (c >= '0' && c <= '9') r = r * 10 + (c - '0'), c = getchar();
  return r * sign;
}
template <typename T>
inline void print(T* a, int n) {
  for (int i = 1; i < n; ++i) cout << a[i] << " ";
  cout << a[n] << endl;
}
int n, m, r, a[510 + 1][510 + 1], sum[510 + 1][510 + 1], len[2000 + 1],
    w[510 + 1][510 + 1], dist[2000 + 1];
int pre[510 + 1][510 + 1], suf[510 + 1][510 + 1], prec[510 + 1][510 + 1],
    sufc[510 + 1][510 + 1];
inline bool in(int a, int b) { return a * a + b * b <= r * r; }
int main(int argc, char* argv[]) {
  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) sum[i][j] = sum[i][j - 1] + a[i][j];
  for (int i = 0; i <= r; ++i)
    while (in(i, len[i])) ++len[i];
  for (int i = 0; i <= 2 * r; ++i)
    for (int j = 0; j <= i; ++j)
      if (len[j] > 0 && len[i - j] > 0)
        dist[i] = max(dist[i], len[j] + len[i - j]);
  for (int i = r + 1; i <= n - r; ++i) {
    int up = max(1, i - r), down = min(n, i + r);
    for (int j = r + 1; j <= m - r; ++j)
      for (int k = up; k <= down; ++k)
        w[i][j] += sum[k][min(m, j + len[abs(k - i)] - 1)] -
                   sum[k][max(0, j - len[abs(k - i)])];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j)
      if (w[i][j] > pre[i][j - 1]) {
        pre[i][j] = w[i][j], prec[i][j] = 1;
      } else if (w[i][j] == pre[i][j - 1]) {
        pre[i][j] = w[i][j], prec[i][j] = prec[i][j - 1] + 1;
      } else {
        pre[i][j] = pre[i][j - 1], prec[i][j] = prec[i][j - 1];
      }
    for (int j = m; j > 0; --j)
      if (w[i][j] > suf[i][j + 1]) {
        suf[i][j] = w[i][j], sufc[i][j] = 1;
      } else if (w[i][j] == suf[i][j + 1]) {
        suf[i][j] = w[i][j], sufc[i][j] = sufc[i][j + 1] + 1;
      } else {
        suf[i][j] = suf[i][j + 1], sufc[i][j] = sufc[i][j + 1];
      }
  }
  int ans = 0;
  long long ways = 0LL;
  for (int i = r + 1; i <= n - r; ++i) {
    for (int j = r + 1; j <= m - r; ++j) {
      for (int k = r + 1; k <= n - r; ++k) {
        int l = max(0, j - dist[abs(k - i)] + 1);
        int r = min(m + 1, j + dist[abs(k - i)] - 1);
        if (l >= r) l = j - 1, r = j;
        int cur = max(pre[k][l], suf[k][r]);
        if (!cur) continue;
        long long curw = 0LL;
        if (l > 0 && pre[k][l] == cur) curw += prec[k][l];
        if (r <= m && suf[k][r] == cur) curw += sufc[k][r];
        cur += w[i][j];
        if (cur > ans) {
          ans = cur, ways = curw;
        } else if (cur == ans) {
          ways += curw;
        }
      }
    }
  }
  printf("%d %I64d\n", ans, ways / 2LL);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
