#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int N = 510;
const int M = 2000010;
const int mod = 1000000007;
const long long inf = 0x3f3f3f3f3f3f3f3fll;
const double eps = 1e-6;
using namespace std;
int n, m, r, a[N][N], sum[N][N], sumR[N][N];
int d[N];
pair<int, int> Left[N][N], Right[N][N];
int Sum(int first, int second, int r) {
  int sum = 0;
  for (int i = first - r; i <= first + r; i++) {
    int dis = max(sqrt(((r) * (r)) - ((i - first) * (i - first))) - 1, 0.0);
    while (((dis + 1) * (dis + 1)) + ((i - first) * (i - first)) <= ((r) * (r)))
      dis++;
    sum += sumR[i][second + dis] - sumR[i][second - dis - 1];
  }
  return sum;
}
int Check(int first, int second, int r) {
  for (int a = 0; a <= r; a++)
    for (int b = 0; ((a) * (a)) + ((b) * (b)) <= ((r) * (r)); b++) {
      if (((first - a) * (first - a)) + ((second - b) * (second - b)) <=
          ((r) * (r)))
        return false;
    }
  return true;
}
int main() {
  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]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sumR[i][j] = sumR[i][j - 1] + a[i][j];
  for (int i = r + 1; i <= n - r; i++)
    for (int j = r + 1; j <= m - r; j++) sum[i][j] = Sum(i, j, r);
  memset(d, 0, sizeof(d));
  int dis = r + r + 2;
  for (int i = 0; i <= r + r; i++) {
    while (dis >= 0 && Check(i, dis - 1, r)) dis--;
    d[i] = dis;
  }
  for (int i = r + 1; i <= n - r; i++)
    for (int j = r + 1; j <= m - r; j++) {
      Left[i][j] = Left[i][j - 1];
      if (sum[i][j] > Left[i][j].first)
        Left[i][j] = make_pair(sum[i][j], 1);
      else if (sum[i][j] == Left[i][j].first)
        Left[i][j].second++;
    }
  for (int i = r + 1; i <= n - r; i++)
    for (int j = m - r; j >= r + 1; j--) {
      Right[i][j] = Right[i][j + 1];
      if (sum[i][j] > Right[i][j].first)
        Right[i][j] = make_pair(sum[i][j], 1);
      else if (sum[i][j] == Right[i][j].first)
        Right[i][j].second++;
    }
  int ret = 0;
  long long cnt = 0;
  for (int i = r + 1; i <= n - r; i++)
    for (int j = r + 1; j <= m - r; j++) {
      for (int k = r + 1; k <= n - r; k++) {
        int dis = d[abs(k - i)];
        if (dis == 0) {
          if (ret < Left[k][m - r].first + sum[i][j])
            ret = Left[k][m - r].first + sum[i][j], cnt = Left[k][m - r].second;
          else if (ret == Left[k][m - r].first + sum[i][j])
            cnt += Left[k][m - r].second;
        } else {
          if (j - dis >= r + 1) {
            if (ret < Left[k][j - dis].first + sum[i][j])
              ret = Left[k][j - dis].first + sum[i][j],
              cnt = Left[k][j - dis].second;
            else if (ret == Left[k][j - dis].first + sum[i][j])
              cnt += Left[k][j - dis].second;
          }
          if (j + dis <= m - r) {
            if (ret < Right[k][j + dis].first + sum[i][j])
              ret = Right[k][j + dis].first + sum[i][j],
              cnt = Right[k][j + dis].second;
            else if (ret == Right[k][j + dis].first + sum[i][j])
              cnt += Right[k][j + dis].second;
          }
        }
      }
    }
  cout << ret << " " << cnt / 2 << endl;
  return 0;
}
