#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, k, n, m, q, p, x;
  cin >> n >> m >> k >> p;
  vector<long long> rowSum(n, 0), colSum(m, 0);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> x;
      rowSum[i] += x;
      colSum[j] += x;
    }
  }
  multiset<long long> s;
  long long cur;
  vector<long long> row(k + 1, 0), col(k + 1, 0);
  row[0] = col[0] = 0;
  for (auto &x : rowSum) s.insert(x);
  for (i = 1; i <= k; i++) {
    cur = *s.rbegin();
    s.erase(s.find(cur));
    s.insert(cur - m * p);
    row[i] = row[i - 1] + cur;
  }
  s.clear();
  for (auto &x : colSum) s.insert(x);
  for (i = 1; i <= k; i++) {
    cur = *s.rbegin();
    s.erase(s.find(cur));
    s.insert(cur - n * p);
    col[i] = col[i - 1] + cur;
  }
  row[0] = 0;
  long long ans = LLONG_MIN;
  for (i = 0; i <= k; i++) {
    ans = max(ans, row[i] + col[k - i] - (k - i) * (i * p));
  }
  cout << ans << endl;
  return 0;
}
