#include <bits/stdc++.h>
using namespace std;
const long long NR = 1100, MR = 1100000;
long long n, m, k, p, a, sum, maxn, h[NR], l[NR], mh[MR], ml[MR];
priority_queue<long long> q1, q2;
int main() {
  scanf("%lld%lld%lld%lld", &n, &m, &k, &p);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      scanf("%lld", &a);
      h[i] += a;
      l[j] += a;
    }
  }
  for (long long i = 1; i <= n; i++) {
    q1.push(h[i]);
  }
  for (long long i = 1; i <= m; i++) {
    q2.push(l[i]);
  }
  sum = 0;
  for (long long i = 1; i <= k; i++) {
    long long tmp = q1.top();
    sum += tmp;
    mh[i] = sum;
    q1.pop();
    q1.push(tmp - p * m);
  }
  sum = 0;
  for (long long i = 1; i <= k; i++) {
    long long tmp = q2.top();
    sum += tmp;
    ml[i] = sum;
    q2.pop();
    q2.push(tmp - p * n);
  }
  maxn = -(1ll << 60);
  for (long long i = 0; i <= k; i++) {
    maxn = max(maxn, mh[i] + ml[k - i] - p * i * (k - i));
  }
  printf("%lld", maxn);
  return 0;
}
