#include <bits/stdc++.h>
using namespace std;
long long C[1003], R[1003], Rsub, Csub, Rres[1000006], Cres[1000006];
set<pair<long long, long long> > stR, stC;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pair<long long, long long> pa;
  long long n, m, k, p, x, y = 0, res = -1000000000000000000;
  cin >> n >> m >> k >> p;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x;
      R[i] += x;
      C[j] += x;
    }
  }
  for (int i = 0; i < n; i++) {
    stR.insert({R[i], y++});
  }
  for (int i = 0; i < m; i++) {
    stC.insert({C[i], y++});
  }
  for (int i = 1; i <= k; i++) {
    pa = *stR.rbegin();
    stR.erase(pa);
    stR.insert({pa.first - (p * m), pa.second});
    Rres[i] = pa.first + Rres[i - 1];
    pa = *stC.rbegin();
    stC.erase(pa);
    stC.insert({pa.first - (p * n), pa.second});
    Cres[i] = pa.first + Cres[i - 1];
  }
  for (int i = 0; i <= k; i++) {
    res = max(res, Cres[i] + Rres[k - i] - (k - i) * i * p);
  }
  cout << res << endl;
  return 0;
}
