#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
const long long inf = -99999999999999999;
long long row, col, k, p;
long long sumr[1001];
long long sumc[1001];
long long answerR[1000001];
long long answerC[1000001];
priority_queue<long long> Rtmp, Ctmp;
int main() {
  scanf("%I64d %I64d %I64d %I64d", &row, &col, &k, &p);
  memset(sumr, 0, sizeof(sumr));
  memset(sumc, 0, sizeof(sumc));
  long long tmp;
  for (int i = 1; i <= row; i++) {
    for (int j = 1; j <= col; j++) {
      scanf("%I64d", &tmp);
      sumr[i] += tmp;
      sumc[j] += tmp;
    }
  }
  for (int i = 1; i <= row; i++) {
    Rtmp.push(sumr[i]);
  }
  for (int i = 1; i <= col; i++) {
    Ctmp.push(sumc[i]);
  }
  memset(answerR, 0, sizeof(answerR));
  memset(answerC, 0, sizeof(answerC));
  long long ans = 0;
  for (int j = 1; j <= k; j++) {
    ans += Rtmp.top();
    tmp = Rtmp.top();
    tmp -= col * p;
    Rtmp.pop();
    Rtmp.push(tmp);
    answerR[j] = ans;
  }
  ans = 0;
  for (int j = 1; j <= k; j++) {
    ans += Ctmp.top();
    tmp = Ctmp.top();
    tmp -= row * p;
    Ctmp.pop();
    Ctmp.push(tmp);
    answerC[j] = ans;
  }
  long long answer = inf;
  for (int i = 0; i <= k; i++) {
    answer = max(answer, answerR[i] + answerC[k - i] - i * (k - i) * p);
  }
  printf("%I64d\n", answer);
  return 0;
}
