#include <bits/stdc++.h>
using namespace std;
long long ans = LLONG_MIN;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  long long rowsum[1002] = {0}, colsum[1002] = {0};
  long long a;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a;
      rowsum[i] += a;
      colsum[j] += a;
    }
  }
  priority_queue<long long> rows, cols, row1;
  priority_queue<long long, vector<long long>, greater<long long> > col1;
  vector<long long> row, col;
  for (int i = 0; i < n; i++) {
    rows.push(rowsum[i]);
  }
  for (int i = 0; i < m; i++) {
    cols.push(colsum[i]);
  }
  long long sum = 0;
  long long i = k;
  row.push_back(0);
  while (i--) {
    long long a = rows.top();
    sum += a;
    row.push_back(sum);
    rows.pop();
    rows.push(a - m * p);
  }
  i = k;
  sum = 0;
  col.push_back(0);
  while (i--) {
    long long a = cols.top();
    sum += a;
    col.push_back(sum);
    cols.pop();
    cols.push(a - n * p);
  }
  for (int i = 0; i <= k; i++) {
    long long a = row[k - i];
    long long b = col[i];
    ans = max(ans, a + b - i * (k - i) * p);
  }
  cout << ans << endl;
  return 0;
}
