#include <bits/stdc++.h>
using namespace std;
long long a[1003][1003];
priority_queue<long long> r, c;
long long C[2000005], R[2000005];
int main() {
  long long n, m, k, p, s = 0, ans = -1000000000000000000, val, i, j;
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; i++) {
    s = 0;
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      s += a[i][j];
    }
    r.push(s);
  }
  for (int j = 1; j <= m; j++) {
    s = 0;
    for (int i = 1; i <= n; i++) {
      s += a[i][j];
    }
    c.push(s);
  }
  for (int i = 1; i <= k + 1; i++) {
    val = r.top();
    r.pop();
    R[i] = R[i - 1] + val;
    val -= (m * p);
    r.push(val);
  }
  for (int i = 1; i <= k + 1; i++) {
    val = c.top();
    c.pop();
    C[i] = C[i - 1] + val;
    val -= (n * p);
    c.push(val);
  }
  for (i = 0; i <= k; i++) {
    ans = max(ans, (C[i] + R[k - i]) - (i * (k - i) * p));
  }
  cout << ans << endl;
  return 0;
}
