#include <bits/stdc++.h>
using namespace std;
int inf = 0x3f3f3f3f;
int a[510], b[510];
int c[510][510], s[510][510];
int lmax[510][510], lcnt[510][510], rmax[510][510], rcnt[510][510];
int sum[510][510];
int main() {
  int n, m, r;
  cin >> n >> m >> r;
  for (int j, i = 0; i <= r; ++i) {
    j = 0;
    while (j * j + i * i <= r * r) ++j;
    a[i] = j - 1;
  }
  for (int tmp, i = 0; i <= 2 * r; ++i) {
    tmp = 0;
    for (int j1, j = 0; j <= r; ++j) {
      j1 = i - j;
      if (j1 < 0 || j1 > r) continue;
      tmp = max(tmp, a[j] + a[j1] + 1);
    }
    b[i] = tmp;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &c[i][j]);
      s[i][j] = s[i][j - 1] + c[i][j];
    }
  for (int i = r + 1; i <= n - r; ++i) {
    for (int j = r + 1; j <= m - r; ++j) {
      int ss = s[i][j + r] - s[i][j - r - 1];
      for (int k = 1; k <= r; ++k) {
        ss += s[i - k][j + a[k]] - s[i - k][j - a[k] - 1];
        ss += s[i + k][j + a[k]] - s[i + k][j - a[k] - 1];
      }
      sum[i][j] = ss;
    }
  }
  for (int i = r + 1; i <= n - r; ++i) {
    for (int j = r + 1; j <= m - r; ++j) {
      lmax[i][j] = sum[i][j], lcnt[i][j] = 1;
      if (lmax[i][j - 1] > lmax[i][j])
        lmax[i][j] = lmax[i][j - 1], lcnt[i][j] = lcnt[i][j - 1];
      else if (lmax[i][j] == lmax[i][j - 1])
        lcnt[i][j] += lcnt[i][j - 1];
    }
    for (int j = m - r; j >= r + 1; --j) {
      rmax[i][j] = sum[i][j], rcnt[i][j] = 1;
      if (rmax[i][j + 1] > rmax[i][j])
        rmax[i][j] = rmax[i][j + 1], rcnt[i][j] = rcnt[i][j + 1];
      else if (rmax[i][j + 1] == rmax[i][j])
        rcnt[i][j] += rcnt[i][j + 1];
    }
  }
  int ans = 0;
  int tmp;
  long long cnt = 0;
  for (int i = r + 1; i <= n - r; ++i) {
    for (int j = r + 1; j <= m - r; ++j) {
      for (int x, k = r + 1; k <= n - r; ++k) {
        x = abs(i - k);
        if (x > 2 * r) {
          tmp = rmax[k][r + 1] + sum[i][j];
          if (tmp > ans)
            ans = tmp, cnt = rcnt[k][r + 1];
          else if (tmp == ans)
            cnt += rcnt[k][r + 1];
        } else {
          if (j + b[x] <= m - r) {
            tmp = rmax[k][j + b[x]] + sum[i][j];
            if (tmp > ans)
              ans = tmp, cnt = rcnt[k][j + b[x]];
            else if (tmp == ans)
              cnt += rcnt[k][j + b[x]];
          }
          if (j - b[x] >= r + 1) {
            tmp = lmax[k][j - b[x]] + sum[i][j];
            if (tmp > ans)
              ans = tmp, cnt = lcnt[k][j - b[x]];
            else if (tmp == ans)
              cnt += lcnt[k][j - b[x]];
          }
        }
      }
    }
  }
  printf("%d %I64d\n", ans, cnt / 2);
}
