#include <bits/stdc++.h>
using namespace std;
long long r[1000002], c[1000002], n, m, k, p, x, ans;
priority_queue<long long> rq, cq;
int main() {
  while (~scanf("%lld%lld%lld%lld", &n, &m, &k, &p)) {
    while (!rq.empty()) rq.pop();
    while (!cq.empty()) cq.pop();
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        scanf("%lld", &x);
        r[i] += x;
        c[j] += x;
      }
    for (int i = 1; i <= n; i++) rq.push(r[i]);
    for (int i = 1; i <= m; i++) cq.push(c[i]);
    memset(r, 0, sizeof(r));
    memset(c, 0, sizeof(c));
    for (int i = 1; i <= k; i++) {
      x = rq.top();
      r[i] = r[i - 1] + x;
      rq.pop();
      rq.push(x - m * p);
      x = cq.top();
      c[i] = c[i - 1] + x;
      cq.pop();
      cq.push(x - n * p);
    }
    ans = c[k];
    for (int i = 1; i <= k; i++)
      ans = max(ans, r[i] + c[k - i] - i * (k - i) * p);
    printf("%lld\n", ans);
  }
  return 0;
}
