#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
multiset<long long> rows, cols;
long long rs[N], cs[N];
long long row[1 << 10], col[1 << 10];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int x;
      cin >> x;
      row[i] += x;
      col[j] += x;
    }
  }
  for (int i = 1; i <= n; i++) rows.insert(-row[i]);
  for (int i = 1; i <= m; i++) cols.insert(-col[i]);
  for (int i = 1; i <= k; i++) {
    long long temp = -(*rows.begin());
    rows.erase(rows.begin());
    rs[i] = rs[i - 1] + temp;
    rows.insert(-(temp - p * m));
    temp = -(*cols.begin());
    cols.erase(cols.begin());
    cs[i] = cs[i - 1] + temp;
    cols.insert(-(temp - p * n));
  }
  long long ans = LLONG_MIN;
  for (long long i = 0; i <= k; i++) {
    ans = max(ans, rs[i] + cs[k - i] - i * (k - i) * p);
  }
  cout << ans;
  return 0;
}
