#include <bits/stdc++.h>
using namespace std;
const int N = 510;
int a[N][N];
long long f[N][N], dp[N][N];
int b[N], c[N];
int val[N][N];
void update(long long &a, long long &b, long long x, long long y) {
  if (a < x)
    a = x, b = y;
  else if (a == x)
    b += y;
}
void init(int r) {
  b[0] = r;
  for (int i = 1; i <= r; i++) {
    for (b[i] = b[i - 1]; b[i] >= 0; b[i]--) {
      if (i * i + b[i] * b[i] <= r * r) break;
    }
  }
  c[0] = 2 * r + 1;
  for (int i = 1; i <= 2 * r; i++) {
    for (c[i] = c[i - 1]; c[i] >= 0; c[i]--) {
      bool flag = true;
      for (int k = 0; k <= r && k <= i; k++) {
        if (i - k > r) continue;
        if (b[k] + b[i - k] >= c[i]) flag = false;
      }
      if (!flag) {
        c[i]++;
        break;
      }
    }
  }
}
int main() {
  int n, m, r;
  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]);
      a[i][j] += a[i][j - 1];
    }
  if (2 * r + 1 > min(n, m)) {
    cout << "0 0" << endl;
    return 0;
  }
  init(r);
  for (int i = r + 1; i + r <= n; i++) {
    for (int j = r + 1; j + r <= m; j++) {
      f[i][j] = f[i][j - 1];
      dp[i][j] = dp[i][j - 1];
      for (int k = 0; k <= r; k++) {
        val[i][j] += a[i - k][j + b[k]] - a[i - k][j - b[k] - 1];
        if (k) val[i][j] += a[i + k][j + b[k]] - a[i + k][j - b[k] - 1];
      }
      update(f[i][j], dp[i][j], val[i][j], 1);
    }
  }
  long long ans = 0, sum = 0;
  for (int i = r + 1; i + r <= n; i++) {
    for (int j = r + 1; j + r <= m; j++) {
      for (int k = i; k + r <= n; k++) {
        if (k - i > 2 * i) {
          update(ans, sum, val[i][j] + f[k][j], dp[k][j]);
          continue;
        }
        int pos = j - c[k - i];
        if (pos < r + 1) continue;
        update(ans, sum, val[i][j] + f[k][pos], dp[k][pos]);
      }
    }
  }
  for (int i = r + 1; i + r <= n; i++) {
    for (int j = r + 1; j + r <= m; j++) {
      for (int k = i - 1; k >= r + 1; k--) {
        if (i - k > 2 * i) {
          if (j > r + 1)
            update(ans, sum, val[i][j] + f[k][j - 1], dp[k][j - 1]);
          continue;
        }
        int pos = min(j - 1, j - c[i - k]);
        if (pos < r + 1) continue;
        update(ans, sum, val[i][j] + f[k][pos], dp[k][pos]);
      }
    }
  }
  cout << ans << " " << sum << endl;
  return 0;
}
