#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
long long n, m, k, p;
long long a[1001][1001];
long long r[maxn], c[maxn];
int main() {
  scanf("%I64d%I64d%I64d%I64d", &n, &m, &k, &p);
  priority_queue<long long> row, col;
  while (!row.empty()) row.pop();
  while (!col.empty()) col.pop();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%I64d", &a[i][j]);
  for (long long i = 1; i <= n; i++) {
    long long t = 0;
    for (long long j = 1; j <= m; j++) {
      t += a[i][j];
    }
    row.push(t);
  }
  for (long long i = 1; i <= m; i++) {
    long long t = 0;
    for (long long j = 1; j <= n; j++) {
      t += a[j][i];
    }
    col.push(t);
  }
  c[0] = r[0] = 0;
  for (long long i = 1; i <= k; i++) {
    r[i] = r[i - 1] + row.top();
    row.push(row.top() - m * p);
    row.pop();
  }
  for (long long i = 1; i <= k; i++) {
    c[i] = c[i - 1] + col.top();
    col.push(col.top() - n * p);
    col.pop();
  }
  long long ans = r[0] + c[k];
  for (long long i = 0; i <= k; i++) {
    ans = max(ans, r[i] + c[k - i] - i * (k - i) * p);
  }
  printf("%I64d\n", ans);
}
