#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 1e6 + 5;
const long long Inf = 1e17;
priority_queue<long long> qh, ql;
int n, m, K, v0;
long long h[N], l[N], ah[M], al[M], ans = -Inf;
int main() {
  scanf("%d%d%d%d", &n, &m, &K, &v0);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      h[i] += x, l[j] += x;
    }
  for (int i = 1; i <= n; i++) qh.push(h[i]);
  for (int i = 1; i <= m; i++) ql.push(l[i]);
  for (int i = 1; i <= K; i++) {
    long long x = qh.top();
    qh.pop();
    ah[i] = ah[i - 1] + x;
    qh.push(x - m * v0);
  }
  for (int i = 1; i <= K; i++) {
    long long x = ql.top();
    ql.pop();
    al[i] = al[i - 1] + x;
    ql.push(x - n * v0);
  }
  for (int i = 0; i <= K; i++) {
    long long w = al[i] + ah[K - i] - 1ll * i * (K - i) * v0;
    ans = max(ans, w);
  }
  printf("%lld\n", ans);
  return 0;
}
