#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10;
const long long MN = 5e2 + 10;
long long n, m, r;
long long arr[MN][MN], ps[MN][MN], pre[MN], pre2[MN];
pair<long long, long long> mxl[MN][MN], mxr[MN][MN];
void input() {
  cin >> n >> m >> r;
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < m; ++j) {
      cin >> arr[i][j];
      ps[i][j + 1] = ps[i][j] + arr[i][j];
    }
  if (r >= MN) {
    printf("0 0\n");
    exit(0);
  }
}
void prep() {
  memset(pre, -1, sizeof pre);
  for (long long i = 0; i < MN; ++i)
    for (long long j = MN - 1; ~j; --j) {
      if (i * i + j * j <= r * r) {
        pre[i] = j;
        break;
      }
    }
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < m; ++j) {
      if (min(i, j) < r || min(n - i - 1, m - j - 1) < r)
        arr[i][j] = -INF;
      else {
        long long tmp = 0;
        for (long long l = 0; l < n; ++l)
          if (~pre[abs(i - l)]) {
            long long t = pre[abs(i - l)];
            tmp += ps[l][j + t + 1] - ps[l][j - t];
          }
        arr[i][j] = tmp;
      }
    }
  for (long long i = 0; i < n; ++i) {
    mxl[i][0] = make_pair(-INF, 1);
    for (long long j = 0; j < m; ++j) {
      if (arr[i][j] > mxl[i][j].first)
        mxl[i][j + 1] = make_pair(arr[i][j], 1);
      else if (arr[i][j] == mxl[i][j].first)
        mxl[i][j + 1] = mxl[i][j], mxl[i][j + 1].second++;
      else
        mxl[i][j + 1] = mxl[i][j];
    }
    mxr[i][m] = make_pair(-INF, 1);
    for (long long j = m - 1; ~j; --j) {
      if (arr[i][j] > mxr[i][j + 1].first)
        mxr[i][j] = make_pair(arr[i][j], 1);
      else if (arr[i][j] == mxr[i][j + 1].first)
        mxr[i][j] = mxr[i][j + 1], mxr[i][j].second++;
      else
        mxr[i][j] = mxr[i][j + 1];
    }
  }
  memset(pre2, -1, sizeof pre2);
  for (long long i = 0; i < MN; ++i)
    for (long long j = 0; j < MN; ++j) {
      bool fl = false;
      for (long long l = 0; l < MN && l <= i; ++l)
        if (~pre[l]) {
          long long t = j - pre[l], t1 = i - l;
          if (t * t + t1 * t1 <= r * r) fl = true;
        }
      if (!fl) {
        pre2[i] = j;
        break;
      }
    }
}
void solve() {
  pair<long long, long long> ans(-INF, 1);
  for (long long i = r; i < n - r; ++i)
    for (long long j = r; j < m - r; ++j) {
      long long Mx = -INF, tg = 1;
      long long r = i, c = j;
      for (long long l = 0; l < n; ++l) {
        long long t = pre2[abs(l - r)];
        if (t == 0) {
          if (Mx < mxl[l][m].first)
            Mx = mxl[l][m].first, tg = mxl[l][m].second;
          else if (Mx == mxl[l][m].first)
            tg += mxl[l][m].second;
          continue;
        }
        if (t == -1) continue;
        long long r_ = t + j;
        if (r_ < m) {
          if (mxr[l][r_].first > Mx)
            Mx = mxr[l][r_].first, tg = mxr[l][r_].second;
          else if (mxr[l][r_].first == Mx)
            tg += mxr[l][r_].second;
        }
        r_ = j - t;
        if (r_ == t + j) --r_;
        if (r_ >= 0) {
          if (mxl[l][r_ + 1].first > Mx)
            Mx = mxl[l][r_ + 1].first, tg = mxl[l][r_ + 1].second;
          else if (mxl[l][r_ + 1].first == Mx)
            tg += mxl[l][r_ + 1].second;
        }
      }
      Mx += arr[r][c];
      if (Mx <= arr[r][c]) continue;
      if (Mx > ans.first)
        ans = make_pair(Mx, tg);
      else if (Mx == ans.first)
        ans.second += tg;
    }
  if (ans.first < 0)
    cout << 0 << ' ' << 0 << endl;
  else
    cout << ans.first << ' ' << ans.second / 2 << endl;
}
int32_t main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
  prep();
  solve();
  return 0;
}
