#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int inf = 1000000007;
int n, m, k, p;
int a[N][N];
long long r[N * N], c[N * N];
priority_queue<long long> sum;
int main() {
  scanf("%d %d %d %d", &n, &m, &k, &p);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) scanf("%d", &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];
    sum.push(s);
  }
  for (int i = 1; i <= k; i++) {
    long long s = sum.top();
    sum.pop();
    r[i] = r[i - 1] + s;
    sum.push(s - p * 1LL * m);
  }
  while (!sum.empty()) sum.pop();
  for (int i = 1; i <= m; i++) {
    long long s = 0;
    for (int j = 1; j <= n; j++) s += a[j][i];
    sum.push(s);
  }
  for (int i = 1; i <= k; i++) {
    long long s = sum.top();
    sum.pop();
    c[i] = c[i - 1] + s;
    sum.push(s - p * 1LL * n);
  }
  long long ans = -(1LL << 60);
  for (int i = 0; i <= k; i++) {
    ans = max(ans, r[i] + c[k - i] - i * 1LL * (k - i) * p);
  }
  printf("%I64d\n", ans);
  return 0;
}
