#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> p, q;
long long r[2001], c[2001];
long long ansr[4000001], ansc[4000001];
long long ans = -1e14;
int main() {
  long long n, m, s, t, x;
  scanf("%lld%lld%lld%lld", &n, &m, &s, &t);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      scanf("%lld", &x);
      r[i] += x;
      c[j] += x;
    }
  }
  for (long long i = 1; i <= n; i++) {
    p.push(r[i]);
  }
  for (long long i = 1; i <= m; i++) {
    q.push(c[i]);
  }
  for (long long i = 1; i <= s; i++) {
    x = p.top();
    ansr[i] = ansr[i - 1] + x;
    p.pop();
    p.push(x - m * t);
  }
  for (long long i = 1; i <= s; i++) {
    x = q.top();
    ansc[i] = ansc[i - 1] + x;
    q.pop();
    q.push(x - n * t);
  }
  for (long long i = 0; i <= s; i++) {
    if (ans < ansr[i] + ansc[s - i] - i * (s - i) * t) {
      ans = ansr[i] + ansc[s - i] - i * (s - i) * t;
    }
  }
  printf("%lld", ans);
  return 0;
}
