#include <bits/stdc++.h>
using namespace std;
int n, m, r;
int map_x[510][510];
int l_x[510][510];
int circle_x[510][510];
int val_l[510][510], val_ln[510][510];
int val_r[510][510], val_rn[510][510];
int nn[510];
int diff[1010];
int ans;
long long ans_num = 0;
int main() {
  scanf("%d%d%d", &n, &m, &r);
  for (int i = 0; i <= r; i++)
    for (int j = 0; j <= r; j++)
      if (j * j <= r * r - i * i) nn[i] = j;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%d", &map_x[i][j]);
      l_x[i][j] = l_x[i][j - 1] + map_x[i][j];
    }
  for (int i = 1 + r; i <= n - r; i++)
    for (int j = 1 + r; j <= m - r; j++) {
      val_l[i][j] = val_l[i][j - 1];
      val_ln[i][j] = val_ln[i][j - 1];
      for (int ii = i - r; ii <= i + r; ii++) {
        int x = abs(ii - i);
        int jj = nn[x];
        circle_x[i][j] += l_x[ii][j + jj] - l_x[ii][j - jj - 1];
      }
      if (val_l[i][j] == circle_x[i][j]) val_ln[i][j]++;
      if (val_l[i][j] < circle_x[i][j]) {
        val_l[i][j] = circle_x[i][j];
        val_ln[i][j] = 1;
      }
    }
  for (int i = 1 + r; i <= n - r; i++)
    for (int j = m - r; j >= 1 + r; j--) {
      val_r[i][j] = val_r[i][j + 1];
      val_rn[i][j] = val_rn[i][j + 1];
      if (val_r[i][j] == circle_x[i][j]) val_rn[i][j]++;
      if (val_r[i][j] < circle_x[i][j]) {
        val_r[i][j] = circle_x[i][j];
        val_rn[i][j] = 1;
      }
    }
  for (int i = 0; i <= r * 2; ++i) {
    int tmp = 0;
    for (int j = 0; j <= r; ++j) {
      if (j > r || j < i - r) continue;
      int xx = abs(i - j);
      if (nn[j] + 1 + nn[xx] > tmp) tmp = nn[j] + 1 + nn[xx];
    }
    diff[i] = tmp;
  }
  for (int i = 1 + r; i <= n - r; i++)
    for (int j = 1 + r; j <= m - r; j++) {
      int temp = 0;
      long long temp_num = 0;
      for (int ii = i; ii <= n - r; ii++) {
        int jj1 = j, jj2 = j;
        jj1 -= diff[ii - i];
        jj2 += diff[ii - i];
        if (ii == i) jj1 = 0;
        if (jj1 == jj2) jj1--;
        if (jj1 >= 1 + r && temp == val_l[ii][jj1]) temp_num += val_ln[ii][jj1];
        if (jj1 >= 1 + r && temp < val_l[ii][jj1]) {
          temp = val_l[ii][jj1];
          temp_num = val_ln[ii][jj1];
        }
        if (jj2 <= m - r && temp == val_r[ii][jj2]) temp_num += val_rn[ii][jj2];
        if (jj2 <= m - r && temp < val_r[ii][jj2]) {
          temp = val_r[ii][jj2];
          temp_num = val_rn[ii][jj2];
        }
      }
      if (temp && ans == temp + circle_x[i][j]) ans_num += temp_num;
      if (temp && ans < temp + circle_x[i][j]) {
        ans = temp + circle_x[i][j];
        ans_num = temp_num;
      }
    }
  printf("%d %I64d", ans, ans_num);
}
