#include <bits/stdc++.h>
using namespace std;
long long ra[1000001] = {}, ca[1000001] = {};
int main() {
  int n, m, k, p, a, r[1000] = {}, c[1000] = {};
  long long ans = LLONG_MIN, rm, cm;
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      scanf("%d", &a);
      r[i] += a;
      c[j] += a;
    }
  }
  int pm = p * m, pn = p * n;
  priority_queue<long long> sr(r, r + n), sc(c, c + m);
  for (int i = 1; i <= k; ++i) {
    rm = sr.top();
    cm = sc.top();
    sr.pop();
    sc.pop();
    ra[i] = ra[i - 1] + rm;
    ca[i] = ca[i - 1] + cm;
    sr.push(rm - pm);
    sc.push(cm - pn);
  }
  for (int i = 0; k >= 0; ++i, --k)
    ans = std::max(ans, ra[i] + ca[k] - ((long long)(p * i)) * k);
  printf("%I64d", ans);
  return 0;
}
