#include <bits/stdc++.h>
using namespace std;
long long a[1005][1005];
long long col[1005], row[1005];
long long rMove[1000005], cMove[1000005];
set<pair<long long, long long> > rows, cols;
int main() {
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[j][i];
      row[i] += a[j][i];
      col[j] += a[j][i];
    }
  for (int i = 0; i < n; i++)
    rows.insert(pair<long long, long long>(row[i], i));
  for (int i = 0; i < m; i++)
    cols.insert(pair<long long, long long>(col[i], i));
  for (int i = 1; i <= k; i++) {
    pair<long long, long long> best = *(cols.rbegin());
    cols.erase(best);
    cMove[i] = cMove[i - 1] + best.first;
    best.first -= n * p;
    cols.insert(best);
  }
  for (int i = 1; i <= k; i++) {
    pair<long long, long long> best = *(rows.rbegin());
    rows.erase(best);
    rMove[i] = rMove[i - 1] + best.first;
    best.first -= m * p;
    rows.insert(best);
  }
  long long ans = 0;
  bool f = true;
  for (int i = 0; i <= k; i++) {
    long long now = cMove[i] + rMove[k - i] - i * (k - i) * p;
    if (f || now > ans) ans = now;
    f = false;
  }
  cout << ans << endl;
  return 0;
}
