#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> row, col;
int n, m, k;
long long p;
long long a[1010][1010];
long long hh[1000010], lh[1000010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  long long he;
  for (int i = 1; i <= n; i++) {
    he = 0;
    for (int j = 1; j <= m; j++) he += a[i][j];
    row.push(he);
  }
  for (int j = 1; j <= m; j++) {
    he = 0;
    for (int i = 1; i <= n; i++) he += a[i][j];
    col.push(he);
  }
  long long tmp;
  for (int i = 1; i <= k; i++) {
    tmp = row.top();
    row.pop();
    hh[i] = hh[i - 1] + tmp;
    row.push(tmp - m * p);
  }
  for (int i = 1; i <= k; i++) {
    tmp = col.top();
    col.pop();
    lh[i] = lh[i - 1] + tmp;
    col.push(tmp - n * p);
  }
  long long res = LLONG_MIN;
  for (int i = 0; i <= k; i++) {
    res = max(res, hh[i] + lh[k - i] - (long long)(i) * (long long)(k - i) * p);
  }
  cout << res << endl;
  return 0;
}
