#include <bits/stdc++.h>
using namespace std;
int n, m, k, p;
long long r[1010], c[1010];
set<pair<long long, int> > R, C;
long long wR[1010 * 1010], wC[1010 * 1010];
int main() {
  cin >> n >> m >> k >> p;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int x;
      cin >> x;
      r[i] += x;
      c[j] += x;
    }
  for (int i = 0; i < n; i++) R.insert(make_pair(-r[i], i));
  for (int i = 0; i < m; i++) C.insert(make_pair(-c[i], i));
  for (int i = 1; i <= k; i++) {
    pair<long long, int> w = *R.begin();
    wR[i] = wR[i - 1] - w.first;
    R.erase(w);
    w.first += p * m;
    R.insert(w);
  }
  for (int i = 1; i <= k; i++) {
    pair<long long, int> w = *C.begin();
    wC[i] = wC[i - 1] - w.first;
    C.erase(w);
    w.first += p * n;
    C.insert(w);
  }
  long long S = -1e18;
  for (int i = 0; i <= k; i++)
    S = max(S, wR[i] + wC[k - i] - (long long)p * i * (k - i));
  cout << S << endl;
  return 0;
}
