#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
long long s[1000], v[1000], r1[N], r2[N];
int main() {
  int n, m, k, p, i, x, j;
  priority_queue<long long> a, b;
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (i = 0; i < max(n, m); ++i) s[i] = v[i] = 0;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      scanf("%d", &x);
      s[i] += x;
      v[j] += x;
    }
  }
  for (i = 0; i < n; ++i) a.push(s[i]);
  for (i = 0; i < m; ++i) b.push(v[i]);
  long long cur, r = 0, c = 0;
  r1[0] = r2[0] = 0;
  for (i = 1; i <= k; ++i) {
    cur = a.top();
    a.pop();
    r1[i] = r1[i - 1] + cur;
    cur -= m * p;
    a.push(cur);
    cur = b.top();
    b.pop();
    r2[i] = r2[i - 1] + cur;
    cur -= n * p;
    b.push(cur);
  }
  cur = -1e18;
  for (i = 0; i <= k; ++i) {
    cur = max(cur, r1[i] + r2[k - i] - ((long long)i) * (k - i) * p);
  }
  cout << cur << endl;
  return 0;
}
