#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 2000000000;
const long long BIG = 1446803456761533460LL;
const int maxn = 503;
int n, m, r, A[maxn][maxn], ps[maxn][maxn], C[maxn][maxn], L[maxn], L2[maxn];
pair<int, long long> pmxl[maxn][maxn], pmxr[maxn][maxn], pmxd[maxn], pmxu[maxn];
pair<int, long long> ans;
void add(pair<int, long long> &a, pair<int, long long> b) {
  if (b.first > a.first)
    a = b;
  else if (a.first == b.first)
    a.second += b.second;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> r;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> A[i][j];
  L[0] = r;
  for (int i = 1; i < r + 1; ++i) {
    L[i] = L[i - 1];
    while (L[i] && L[i] * L[i] + i * i > r * r) --L[i];
  }
  for (int i = 0; i < r + 1; ++i) {
    for (int j = 0; j < r + 1; ++j) {
      L2[i + j] = max(L2[i + j], (L[i] + L[j]));
      if (i >= j) L2[i - j] = max(L2[i - j], (L[i] + L[j]));
    }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) ps[i][j + 1] = ps[i][j] + A[i][j];
  for (int i = r; i < n - r; ++i)
    for (int j = r; j < m - r; ++j) {
      C[i][j] = ps[i][j + r + 1] - ps[i][j - r];
      for (int k = 1; k < r + 1; ++k) {
        C[i][j] += ps[i + k][j + L[k] + 1] - ps[i + k][j - L[k]];
        C[i][j] += ps[i - k][j + L[k] + 1] - ps[i - k][j - L[k]];
      }
    }
  for (int i = r; i < n - r; ++i)
    for (int j = 0; j < m; ++j) {
      pmxl[i][j + 1] = pmxl[i][j];
      if (r <= j && j < m - r) add(pmxl[i][j + 1], {C[i][j], 1});
      pmxr[i][m - 1 - j] = pmxr[i][m - j];
      if (r <= m - 1 - j && m - 1 - j < m - r)
        add(pmxr[i][m - 1 - j], {C[i][m - 1 - j], 1});
    }
  for (int i = 0; i < n; ++i) {
    pmxu[i + 1] = pmxu[i];
    add(pmxu[i + 1], pmxr[i][0]);
    pmxd[n - 1 - i] = pmxd[n - i];
    add(pmxd[n - 1 - i], pmxr[n - 1 - i][0]);
  }
  for (int i = r; i < n - r; ++i)
    for (int j = r; j < m - r; ++j) {
      pair<int, long long> v = {0, 0};
      add(v, pmxu[max(0, i - r * 2)]);
      add(v, pmxd[min(n, i + 1 + r * 2)]);
      for (int k = max(0, i - r * 2); k < i; ++k) {
        add(v, pmxl[k][max(0, j - L2[i - k])]);
        add(v, pmxr[k][min(m, j + 1 + L2[i - k])]);
      }
      for (int k = i; k < min(n, i + r * 2 + 1); ++k) {
        add(v, pmxl[k][max(0, j - L2[k - i])]);
        add(v, pmxr[k][min(m, j + 1 + L2[k - i])]);
      }
      if (v.second) add(ans, {v.first + C[i][j], v.second});
    }
  cout << ans.first << ' ' << ans.second / 2 << '\n';
}
