#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
int n, m, k, x, p;
int mat[1005][1005];
void solve(int tc) {
  cin >> n >> m >> k >> p;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> mat[i][j];
    }
  }
  multiset<int, greater<int> > msRow, msCol;
  for (int r = 0; r < n; ++r) {
    long long int rowSum = 0LL;
    for (int i = 0; i < m; ++i) {
      rowSum += mat[r][i];
    }
    msRow.insert(rowSum);
  }
  for (int c = 0; c < m; ++c) {
    long long int colSum = 0LL;
    for (int i = 0; i < n; ++i) {
      colSum += mat[i][c];
    }
    msCol.insert(colSum);
  }
  vector<long long int> rows(k + 1, 0LL), cols(k + 1, 0LL);
  for (int i = 1; i <= k; ++i) {
    rows[i] = *msRow.begin();
    msRow.erase(msRow.begin());
    msRow.insert(rows[i] - (1LL * p * m));
    rows[i] += rows[i - 1];
    cols[i] = *msCol.begin();
    msCol.erase(msCol.begin());
    msCol.insert(cols[i] - (1LL * p * n));
    cols[i] += cols[i - 1];
  }
  long long int ans = -inf;
  for (int i = 0; i <= k; ++i) {
    long long int tp = rows[i] + cols[k - i];
    tp -= 1LL * p * i * (k - i);
    ans = max(ans, tp);
  }
  cout << ans << "\n";
}
int main() {
  cout << fixed << setprecision(10);
  int tt = 1;
  for (int i = 1; i <= tt; ++i) {
    solve(i);
  }
  return 0;
}
