#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int n, m, k, p;
long long row[N], col[N], sumrow[N * N], sumcol[N * N];
multiset<long long> rows, cols;
long long colsub, rowsub;
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;
      row[i] += x;
      col[j] += x;
    }
  }
  for (int i = 0; i < n; i++) rows.insert(-row[i]);
  for (int i = 0; i < m; i++) cols.insert(-col[i]);
  long long ans = -1e18, srow = 0, scol = 0;
  for (int i = 0; i < k; i++) {
    {
      long long tmp = -(*rows.begin());
      rows.erase(rows.begin());
      rows.insert(-(tmp - m * p));
      srow += tmp;
      sumrow[i + 1] = srow;
    }
    {
      long long tmp = -(*cols.begin());
      cols.erase(cols.begin());
      cols.insert(-(tmp - n * p));
      scol += tmp;
      sumcol[i + 1] = scol;
    }
  }
  for (int i = 0; i <= k; i++) {
    long long cur = sumrow[i] + sumcol[k - i] - (long long)i * (k - i) * p;
    ans = max(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
