#include <bits/stdc++.h>
using namespace std;
int mp[505][505];
int sum[505][505];
int val[505][505];
int rnd[505];
int tanr[505];
int pre[505][505];
int pcnt[505][505];
int suf[505][505];
int scnt[505][505];
int n, m, r;
void GetRound() {
  rnd[0] = r;
  for (int i = 1; i <= r; i++)
    for (rnd[i] = rnd[i - 1]; i * i + rnd[i] * rnd[i] > r * r; rnd[i]--)
      ;
}
void GetTangent() {
  for (int i = 0; i <= 2 * r; i++) {
    for (int j = i - r; j <= r; j++) {
      int dis1 = j, dis2 = j - i;
      tanr[i] = max(tanr[i], rnd[abs(dis1)] + rnd[abs(dis2)] + 1);
    }
  }
}
void GetVal() {
  memset(mp, 0, sizeof(mp));
  for (int i = r + 1; i <= n - r; i++)
    for (int j = r + 1; j <= m - r; j++)
      for (int k = -r; k <= r; k++)
        mp[i][j] +=
            (sum[i + k][j + rnd[abs(k)]] - sum[i + k][j - rnd[abs(k)] - 1]);
}
void GetMax() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (mp[i][j] > pre[i][j - 1]) {
        pre[i][j] = mp[i][j];
        pcnt[i][j] = 1;
      } else if (mp[i][j] == pre[i][j - 1]) {
        pre[i][j] = mp[i][j];
        pcnt[i][j] = pcnt[i][j - 1] + 1;
      } else {
        pre[i][j] = pre[i][j - 1];
        pcnt[i][j] = pcnt[i][j - 1];
      }
    }
    for (int j = m; j >= 1; j--) {
      if (mp[i][j] > suf[i][j + 1]) {
        suf[i][j] = mp[i][j];
        scnt[i][j] = 1;
      } else if (mp[i][j] == suf[i][j + 1]) {
        suf[i][j] = mp[i][j];
        scnt[i][j] = scnt[i][j + 1] + 1;
      } else {
        suf[i][j] = suf[i][j + 1];
        scnt[i][j] = scnt[i][j + 1];
      }
    }
  }
}
void solve() {
  int ans1 = 0;
  long long ans2 = 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 <= i; k++) {
        int dis = abs(i - k);
        if (dis > 2 * r) {
          if (pre[k][m] > 0) {
            long long temp = pre[k][m] + mp[i][j];
            if (temp > ans1) {
              ans1 = temp;
              ans2 = pcnt[k][m];
            } else if (temp == ans1)
              ans2 += pcnt[k][m];
          }
        } else {
          if (j - tanr[dis] >= r + 1) {
            long long temp = pre[k][j - tanr[dis]] + mp[i][j];
            if (temp > ans1) {
              ans1 = temp;
              ans2 = pcnt[k][j - tanr[dis]];
            } else if (temp == ans1)
              ans2 += pcnt[k][j - tanr[dis]];
          }
          if (k < i && j + tanr[dis] <= m - r) {
            long long temp = suf[k][j + tanr[dis]] + mp[i][j];
            if (temp > ans1) {
              ans1 = temp;
              ans2 = scnt[k][j + tanr[dis]];
            } else if (temp == ans1)
              ans2 += scnt[k][j + tanr[dis]];
          }
        }
      }
  printf("%d %lld\n", ans1, ans2);
}
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", &mp[i][j]);
      sum[i][j] = sum[i][j - 1] + mp[i][j];
    }
  GetRound();
  GetTangent();
  GetVal();
  GetMax();
  solve();
  return 0;
}
