#include <bits/stdc++.h>
using namespace std;
long long a[1000010], b[1000010], cowh[1010], rowh[1010];
int ma[1010][1010], n, m, p, k, now;
long long ans;
int main() {
  int i, j;
  long long ll;
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &ma[i][j]);
  for (i = 1; i <= n; i++) {
    now = 0;
    for (j = 1; j <= m; j++) now += ma[i][j];
    cowh[i - 1] = now;
  }
  for (j = 1; j <= m; j++) {
    now = 0;
    for (i = 1; i <= n; i++) now += ma[i][j];
    rowh[j - 1] = now;
  }
  make_heap(&cowh[0], &cowh[n]);
  make_heap(&rowh[0], &rowh[m]);
  for (i = 1; i <= k; i++) {
    a[i] = a[i - 1] + cowh[0];
    ll = cowh[0] - m * p;
    pop_heap(&cowh[0], &cowh[n]);
    cowh[n - 1] = ll;
    push_heap(&cowh[0], &cowh[n]);
    b[i] = b[i - 1] + rowh[0];
    ll = rowh[0] - n * p;
    pop_heap(&rowh[0], &rowh[m]);
    rowh[m - 1] = ll;
    push_heap(&rowh[0], &rowh[m]);
  }
  ans = b[k];
  for (i = 1; i <= k; i++) {
    ll = a[i] + b[k - i] - (long long)(i) * (long long)(k - i) * (long long)p;
    if (ll > ans) ans = ll;
  }
  printf("%I64d \n", ans);
  return 0;
}
