#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> q1, q2;
long long a[1010][1010], b[1000010], c[1000010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
      b[i] += a[i][j];
      c[j] += a[i][j];
    }
    q1.push(b[i]);
  }
  for (long long i = 1; i <= m; i++) {
    q2.push(c[i]);
  }
  memset(b, 0, sizeof(b));
  memset(c, 0, sizeof(c));
  for (long long i = 1; i <= k; i++) {
    long long cur = q1.top();
    q1.pop();
    b[i] = b[i - 1] + cur;
    cur -= m * p;
    q1.push(cur);
  }
  for (long long i = 1; i <= k; i++) {
    long long cur = q2.top();
    q2.pop();
    c[i] = c[i - 1] + cur;
    cur -= n * p;
    q2.push(cur);
  }
  long long ma = -0x3f3f3f3f3f3f3f3f;
  for (long long i = 0; i <= k; i++) {
    ma = max(ma, b[i] + c[k - i] - i * (k - i) * p);
  }
  cout << ma << endl;
  return 0;
}
