#include <bits/stdc++.h>
using namespace std;
void work();
int main() { work(); }
int mat[1111][1111];
int row[1111];
int col[1111];
long long rarr[1111111];
long long carr[1111111];
void work() {
  int n, m, k, p;
  while (~scanf("%d%d%d%d", &n, &m, &k, &p)) {
    for (int i = 0; i < (n); i++)
      for (int j = 0; j < (m); j++) scanf("%d", &mat[i][j]);
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    for (int i = 0; i < (n); i++)
      for (int j = 0; j < (m); j++) row[i] += mat[i][j], col[j] += mat[i][j];
    int mp = m * p;
    int np = n * p;
    priority_queue<long long> que;
    for (int i = 0; i < (n); i++) que.push(row[i]);
    for (int i = 0; i < (k); i++) {
      long long maxv = que.top();
      rarr[i] = maxv;
      que.pop();
      que.push(maxv - mp);
    }
    priority_queue<long long> que2;
    for (int i = 0; i < (m); i++) que2.push(col[i]);
    for (int i = 0; i < (k); i++) {
      long long maxv = que2.top();
      carr[i] = maxv;
      que2.pop();
      que2.push(maxv - np);
    }
    long long sum = 0;
    int a = k;
    int b = 0;
    for (int i = 0; i < (k); i++) sum += rarr[i];
    long long ans = sum;
    for (int i = 0; i < (k); i++) {
      sum -= rarr[k - i - 1];
      sum += carr[i];
      ans = max(ans, sum - (long long)(k - i - 1) * (i + 1) * p);
    }
    printf("%I64d\n", ans);
  }
}
