#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = ((ans % m) * (a % m)) % m;
    b /= 2;
    a = ((a % m) * (a % m)) % m;
  }
  return ans % m;
}
long long a[1002][1002];
priority_queue<long long> row, col;
long long rpref[1003 * 1003], cpref[1003 * 1003];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> a[i][j];
  for (long long i = 1; i <= n; i++) {
    long long temp = 0;
    for (long long j = 1; j <= m; j++) {
      temp += a[i][j];
    }
    row.push(temp);
  }
  for (long long i = 1; i <= m; i++) {
    long long temp = 0;
    for (long long j = 1; j <= n; j++) {
      temp += a[j][i];
    }
    col.push(temp);
  }
  long long ans = -(long long)1e18 + 5LL;
  for (long long i = 1; i <= k; i++) {
    long long rval = row.top();
    rpref[i] = rpref[i - 1] + rval;
    row.pop();
    rval -= (m * p);
    row.push(rval);
  }
  for (long long i = 1; i <= k; i++) {
    long long cval = col.top();
    cpref[i] = cpref[i - 1] + cval;
    col.pop();
    cval -= (n * p);
    col.push(cval);
  }
  for (long long i = 0; i <= k; i++) {
    long long penality = i * (k - i) * p;
    long long temp = cpref[i] + rpref[k - i] - penality;
    ans = max(ans, temp);
  }
  cout << ans;
}
