#include <bits/stdc++.h>
using namespace std;
const int N = 550, inF = 2e9;
int n, m, R, now, a[N][N], s[N][N], l[N], r[N], maxi_l[N][N], maxi_r[N][N],
    cnt_l[N][N], cnt_r[N][N];
long long ans, cnt;
bool mark[N][N], data[N][N];
int power(int a) { return a * a; }
bool ok(int x1, int y1, int x2, int y2) {
  return power(x1 - x2) + power(y1 - y2) <= R * R;
}
void add(int x, int y) {
  if (mark[x][y] == false) now += a[x][y];
  l[x] = min(l[x], y);
  r[x] = max(r[x], y + 1);
  mark[x][y] = true;
}
void del(int x, int y) {
  now -= a[x][y];
  l[x]++;
  mark[x][y] = false;
}
void upd(long long &maxi, long long &maxi_cnt, int new_maxi, int new_cnt) {
  if (maxi > new_maxi) return;
  if (maxi == new_maxi)
    maxi_cnt += new_cnt;
  else
    maxi = new_maxi, maxi_cnt = new_cnt;
}
void get(int x, int y) {
  long long maxi = 0, maxi_cnt = 0;
  for (int i = 0; i < n; i++) {
    if (l[i]) upd(maxi, maxi_cnt, maxi_l[i][l[i] - 1], cnt_l[i][l[i] - 1]);
    if (l[i] != m) upd(maxi, maxi_cnt, maxi_r[i][r[i]], cnt_r[i][r[i]]);
  }
  if (maxi == 0) return;
  maxi += s[x][y];
  upd(ans, cnt, maxi, maxi_cnt);
}
bool inter(int x1, int y1, int x2, int y2) {
  return data[abs(x1 - x2)][abs(y1 - y2)];
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> R;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  vector<pair<int, int> > help, vec;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      if (ok(0, 0, i, j)) help.push_back(pair<int, int>(i, j));
  sort(help.begin(), help.end());
  help.push_back(pair<int, int>(inF, inF));
  int x = 0, mini = 0, maxi = 0;
  for (pair<int, int> p : help) {
    if (p.first != x) {
      vec.push_back(pair<int, int>(x, mini)),
          vec.push_back(pair<int, int>(x, maxi));
      x = p.first, mini = maxi = p.second;
    } else {
      mini = min(mini, p.second);
      maxi = max(maxi, p.second);
    }
  }
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      for (pair<int, int> p : vec)
        if (ok(i, j, p.first, p.second)) data[i][j] = true;
  for (int i = 0; i < n; i++) {
    now = 0;
    fill(l, l + N, m);
    fill(r, r + N, 0);
    memset(mark, false, sizeof mark);
    for (int x = 0; x < n; x++)
      for (int y = 0; y < m; y++)
        if (ok(i, 0, x, y)) add(x, y);
    s[i][0] = (0 < power(R) ? -inF : now);
    for (int j = 1; j < m; j++) {
      add(i, j);
      for (int k = 0; k < n; k++) {
        while (l[k] < m && ok(i, j, k, l[k]) == false) del(k, l[k]);
        while (r[k] < m && ok(i, j, k, r[k])) add(k, r[k]);
      }
      s[i][j] =
          (power(min(min(n - i - 1, m - j - 1), min(i, j))) < power(R) ? -inF
                                                                       : now);
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      maxi_l[i][j] = max((j ? maxi_l[i][j - 1] : 0), s[i][j]);
      if (j && maxi_l[i][j - 1] == maxi_l[i][j]) cnt_l[i][j] = cnt_l[i][j - 1];
      if (s[i][j] == maxi_l[i][j]) cnt_l[i][j]++;
    }
  for (int i = 0; i < n; i++)
    for (int j = m - 1; j >= 0; j--) {
      maxi_r[i][j] = max(maxi_r[i][j + 1], s[i][j]);
      if (maxi_r[i][j + 1] == maxi_r[i][j]) cnt_r[i][j] = cnt_r[i][j + 1];
      if (s[i][j] == maxi_r[i][j]) cnt_r[i][j]++;
    }
  for (int i = 0; i < n; i++) {
    now = 0;
    fill(l, l + N, N);
    fill(r, r + N, 0);
    memset(mark, false, sizeof mark);
    for (int x = 0; x < n; x++)
      for (int y = 0; y < m; y++)
        if (inter(i, 0, x, y)) add(x, y);
    get(i, 0);
    for (int j = 1; j < m; j++) {
      add(i, j);
      for (int k = 0; k < n; k++) {
        while (l[k] < m && inter(i, j, k, l[k]) == false) del(k, l[k]);
        while (r[k] < m && inter(i, j, k, r[k])) add(k, r[k]);
      }
      get(i, j);
    }
  }
  if (ans < 0) ans = cnt = 0;
  cout << ans << ' ' << cnt / 2;
  return 0;
}
