#include <bits/stdc++.h>
using namespace std;
const int nm = 1005;
int n, k, m, t, p;
int a[nm][nm];
long long sr[nm], sc[nm];
long long maxr[nm * nm], maxc[nm * nm];
priority_queue<long long> r, c;
int main() {
  int i, j;
  long long x, y, z;
  scanf("%d%d", &n, &m);
  scanf("%d%d", &k, &p);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      sr[i] += a[i][j];
      sc[j] += a[i][j];
    }
  for (i = 1; i <= n; i++) r.push(sr[i]);
  for (i = 1; i <= m; i++) c.push(sc[i]);
  for (i = 1; i <= k; i++) {
    x = r.top();
    r.pop();
    maxr[i] = maxr[i - 1] + x;
    r.push(x - m * p);
    y = c.top();
    c.pop();
    maxc[i] = maxc[i - 1] + y;
    c.push(y - n * p);
  }
  long long Max = maxr[k];
  for (i = 0; i <= k; i++) {
    Max = max(Max, maxr[i] + maxc[k - i] - (long long)(i) * (k - i) * p);
  }
  printf("%I64d ", Max);
}
