#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 1000005;
const long long INF = (long long)(1e15);
long long a[N][N];
long long retc[M], retr[M];
priority_queue<pair<long long, int> > sc, sr;
int main() {
  int n, m, k, p;
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%I64d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    long long s = 0;
    for (int j = 1; j <= m; j++) {
      s += a[i][j];
    }
    sr.push(make_pair(s, i));
  }
  for (int j = 1; j <= m; j++) {
    long long s = 0;
    for (int i = 1; i <= n; i++) {
      s += a[i][j];
    }
    sc.push(make_pair(s, j));
  }
  for (int i = 1; i <= k; i++) {
    long long s = sr.top().first;
    int id = sr.top().second;
    retr[i] = retr[i - 1] + s;
    s -= p * m;
    sr.pop();
    sr.push(make_pair(s, id));
  }
  for (int i = 1; i <= k; i++) {
    long long s = sc.top().first;
    int id = sc.top().second;
    retc[i] = retc[i - 1] + s;
    s -= p * n;
    sc.pop();
    sc.push(make_pair(s, id));
  }
  long long ans = -INF;
  for (int i = 0; i <= k; i++) {
    ans = max(ans, retr[i] + retc[k - i] - (long long)i * (k - i) * p);
  }
  printf("%I64d\n", ans);
  return 0;
}
