#include <bits/stdc++.h>
using namespace std;
bool isIn(int cx, int cy, int x, int y, int r) {
  return (cx - x) * (cx - x) + (cy - y) * (cy - y) <= r * r;
}
bool test1(int x1, int y1, int x2, int y2, int r, int n = 53) {
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < n + 1; j++) {
      if (isIn(x1, y1, i, j, r) && isIn(x2, y2, i, j, r)) {
        return true;
      }
    }
  return false;
}
bool fast_test(int x1, int y1, int x2, int y2, int r) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) < r * r * 2 + 1;
}
int max_sqrt[510 * 510];
int num[510][510];
int sum[510][510];
int cir[510][510];
struct DD {
  int max_sum;
  long long ways;
  void print() { printf("max = %d, ways = %d\n", max_sum, ways); }
} ddl[510][510], ddr[510][510];
void update(DD &dd, DD tmp) {
  if (tmp.max_sum == 0) return;
  if (tmp.max_sum > dd.max_sum) {
    dd = tmp;
  } else if (tmp.max_sum == dd.max_sum) {
    dd.ways += tmp.ways;
  }
}
int min_ydis[510];
int cnt[55][55];
DD brute_force(int n, int m, int r) {
  DD ans;
  ans.max_sum = 0;
  ans.ways = 0;
  for (int x1 = r + 1; x1 < n - r + 1; x1++)
    for (int y1 = r + 1; y1 < m - r + 1; y1++) {
      for (int x2 = x1; x2 < n - r + 1; x2++)
        for (int y2 = r + 1; y2 < m - r + 1; y2++) {
          if (x1 == x2 && y1 >= y2) continue;
          if (cir[x1][y1] + cir[x2][y2] < ans.max_sum) continue;
          memset(cnt, 0, sizeof(cnt));
          bool fail = false;
          DD tmp;
          tmp.max_sum = 0;
          for (int i = 1; i < n + 1; i++)
            for (int j = 1; j < m + 1; j++) {
              int q = 0;
              if (isIn(x1, y1, i, j, r)) {
                q++;
                tmp.max_sum += num[i][j];
              }
              if (isIn(x2, y2, i, j, r)) {
                q++;
                tmp.max_sum += num[i][j];
              }
              if (q == 2) {
                fail = true;
                goto end;
              }
            }
        end:;
          if (fail) continue;
          tmp.ways = 1;
          update(ans, tmp);
        }
    }
  return ans;
}
int main() {
  srand(time(NULL));
  for (int i = 1, j = 1; i < 510; i++) {
    while (j < i * i && j < 510 * 510) {
      max_sqrt[j] = i - 1;
      j++;
    }
  }
  int n, m, r;
  while (scanf("%d %d %d", &n, &m, &r) != EOF) {
    memset(min_ydis, 0, sizeof(min_ydis));
    for (int xdis = 0; xdis < n + 1; xdis++) {
      for (int i = 0; i < xdis + 1; i++)
        for (int j = 0; j < m + 1; j++) {
          if (isIn(0, 0, i, j, r)) {
            int tx = xdis - i;
            if (r * r - tx * tx < 0) continue;
            min_ydis[xdis] =
                max(min_ydis[xdis], max_sqrt[r * r - tx * tx] + j + 1);
          }
        }
      if (test1(0, 0, xdis, min_ydis[xdis], r)) {
        assert(false);
      }
    }
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i < n + 1; i++)
      for (int j = 1; j < m + 1; j++) {
        scanf("%d", num[i] + j);
        sum[i][j] = sum[i][j - 1] + num[i][j];
      }
    memset(cir, 0, sizeof(cir));
    for (int i = r + 1; i < n - r + 1; i++)
      for (int j = r + 1; j < m - r + 1; j++) {
        for (int xi = i - r; xi < i + r + 1; xi++) {
          int len = max_sqrt[r * r - (xi - i) * (xi - i)];
          cir[i][j] += sum[xi][j + len] - sum[xi][j - len - 1];
        }
      }
    memset(ddl, 0, sizeof(ddl));
    memset(ddr, 0, sizeof(ddr));
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < m + 1; j++) {
        ddl[i][j] = ddl[i][j - 1];
        DD tmp;
        tmp.max_sum = cir[i][j];
        tmp.ways = 1;
        update(ddl[i][j], tmp);
      }
      for (int j = m; j >= 1; j--) {
        ddr[i][j] = ddr[i][j + 1];
        DD tmp;
        tmp.max_sum = cir[i][j];
        tmp.ways = 1;
        update(ddr[i][j], tmp);
      }
    }
    DD ans;
    ans.max_sum = 0;
    ans.ways = 0;
    for (int i = r + 1; i < n - r + 1; i++)
      for (int j = r + 1; j < m - r + 1; j++) {
        DD dd;
        dd.max_sum = 0;
        dd.ways = 0;
        for (int xi = i; xi < n - r + 1; xi++) {
          int ydis = min_ydis[abs(i - xi)];
          if (ydis == 0) {
            update(dd, ddl[xi][m]);
          } else {
            if (xi != i && j - ydis >= 0) update(dd, ddl[xi][j - ydis]);
            if (j + ydis <= m) update(dd, ddr[xi][j + ydis]);
          }
        }
        if (dd.max_sum && dd.ways) dd.max_sum += cir[i][j];
        update(ans, dd);
      }
    printf("%d %I64d\n", ans.max_sum, ans.ways);
  }
}
