#include <bits/stdc++.h>
using namespace std;
int n, m, r;
bool tk[505][505];
int a[505][505];
vector<int> rgt;
vector<int> lft;
long long start(int x, int y) {
  memset(tk, 0, sizeof(tk));
  int sm = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int dx = i - x;
      int dy = j - y;
      int dis = dx * dx + dy * dy;
      if (dis <= r * r) {
        tk[i][j] = true;
        sm += a[i][j];
      }
    }
  }
  rgt.clear();
  lft.clear();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (tk[i][j] && (j == m - 1 || !tk[i][j + 1])) {
        rgt.push_back(i * m + j);
      }
      if (tk[i][j] && (j == 0 || !tk[i][j - 1])) {
        lft.push_back(i * m + j);
      }
    }
  }
  return sm;
}
long long move() {
  int dif = 0;
  for (int i = 0; i < rgt.size(); i++) {
    int x, y;
    y = rgt[i] % m;
    x = rgt[i] / m;
    dif += a[x][y + 1];
    rgt[i]++;
    tk[x][y] = true;
  }
  for (int i = 0; i < lft.size(); i++) {
    int x, y;
    y = lft[i] % m;
    x = lft[i] / m;
    dif -= a[x][y];
    lft[i]++;
    tk[x][y] = false;
  }
  return dif;
}
int cen[505][505];
int mx[505][505];
int cnt[505][505];
int first[505];
int reach[505];
void initCen() {
  memset(cen, 0, sizeof(cen));
  memset(mx, 0, sizeof(mx));
  memset(cnt, 0, sizeof(cnt));
  for (int i = r; i < n - r; i++) {
    int sm = start(i, r);
    cen[i][r] = sm;
    for (int j = r + 1; j < m - r; j++) {
      sm += move();
      cen[i][j] = sm;
    }
    for (int j = m - r - 1; j >= r; j--) {
      mx[i][j] = cen[i][j];
      if (mx[i][j] > mx[i][j + 1]) {
        cnt[i][j] = 1;
      } else if (mx[i][j] == mx[i][j + 1]) {
        cnt[i][j] = 1 + cnt[i][j + 1];
      } else {
        cnt[i][j] = cnt[i][j + 1];
        mx[i][j] = mx[i][j + 1];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    reach[i] = -m;
    for (int j = 0; j < m; j++) {
      int dx = i;
      int dy = j;
      int dis = dx * dx + dy * dy;
      if (dis <= r * r) {
        reach[i] = j;
      } else
        break;
    }
  }
  for (int i = 0; i < n; i++) {
    first[i] = m;
    for (int j = 0; j < m; j++) {
      bool ok = true;
      for (int k = 0; k <= i; k++) {
        int leftMost = j - reach[k];
        int rightMost = reach[i - k];
        if (rightMost >= leftMost) ok = false;
      }
      if (ok) {
        first[i] = j;
        break;
      }
    }
  }
}
pair<int, long long> solve() {
  int best = 0;
  long long count = 0;
  for (int i = r; i < n - r; i++) {
    for (int j = r; j < m - r; j++) {
      long long sm = cen[i][j];
      for (int k = 0; k <= i; k++) {
        int dx = abs(i - k);
        int col;
        if (dx > 2 * r)
          col = j + 1;
        else
          col = max(j + 1, min(m, j + first[dx]));
        if (sm + mx[k][col] > best && cnt[k][col] > 0) {
          best = sm + mx[k][col];
          count = cnt[k][col];
        } else if (sm + mx[k][col] == best) {
          count += cnt[k][col];
        }
      }
      for (int k = i + 1; k < n - r; k++) {
        int dx = abs(i - k);
        int col;
        if (dx > 2 * r)
          col = j;
        else
          col = max(j, min(m, j + first[dx]));
        if (sm + mx[k][col] > best && cnt[k][col] > 0) {
          best = sm + mx[k][col];
          count = cnt[k][col];
        } else if (sm + mx[k][col] == best) {
          count += cnt[k][col];
        }
      }
    }
  }
  return make_pair(best, count);
}
int main() {
  scanf("%d %d %d", &n, &m, &r);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  initCen();
  pair<int, long long> res = solve();
  if (res.second == 0) res.first = 0;
  printf("%d %lld\n", res.first, res.second);
}
