#include <bits/stdc++.h>
using namespace std;
const int N = 2222;
long long int a[N][N];
long long int rs[N], cs[N];
priority_queue<long long int> pqr, pqc;
long long pref[1234567];
;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k, p;
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      rs[i] += a[i][j];
      cs[j] += a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    pqr.push(rs[i]);
  }
  for (int j = 1; j <= m; j++) {
    pqc.push(cs[j]);
  }
  for (int i = 1; i <= k; i++) {
    long long int cur = pqr.top();
    pqr.pop();
    cur -= p * m;
    pqr.push(cur);
    pref[i] = pref[i - 1] + cur + p * m;
  }
  long long int ans = pref[k];
  long long int col_su = 0;
  for (int i = 1; i <= k; i++) {
    long long int zu = pqc.top();
    pqc.pop();
    zu -= p * n;
    pqc.push(zu);
    col_su += zu + p * n;
    ans = max(ans, col_su - 1LL * (k - i) * i * p + pref[k - i]);
  }
  cout << ans;
}
