#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000100;
const long long INF = 0x3f3f3f3f3f3f3f3f;
long long sc[MAXN], sl[MAXN], pc[MAXN], pl[MAXN];
signed main() {
  memset(pc, 0, sizeof pc);
  memset(pl, 0, sizeof pl);
  memset(sc, 0, sizeof sc);
  memset(sl, 0, sizeof sl);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      long long x;
      cin >> x;
      sl[i] += x;
      sc[j] += x;
    }
  }
  priority_queue<long long> filal, filac;
  for (long long i = 1; i <= n; i++) filal.push(sl[i]);
  for (long long i = 1; i <= m; i++) filac.push(sc[i]);
  for (long long i = 1; i <= k; i++) {
    pl[i] = pl[i - 1] + filal.top();
    long long a = filal.top();
    filal.pop();
    filal.push(a - p * m);
  }
  for (long long i = 1; i <= k; i++) {
    pc[i] = pc[i - 1] + filac.top();
    long long a = filac.top();
    filac.pop();
    filac.push(a - p * n);
  }
  long long resp = -INF;
  for (long long i = 0; i <= k; i++) {
    resp = max(resp, pc[i] + pl[k - i] - (i * (k - i)) * p);
  }
  cout << resp << endl;
}
