#include <bits/stdc++.h>
using namespace std;
const int INF = 1111;
long long row[INF], col[INF];
long long sumrow[INF * INF], sumcol[INF * INF];
multiset<long long> rows, cols;
int n, m, k, p, x;
int main() {
  cin >> n >> m >> k >> p;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) {
      cin >> x;
      row[i] += x;
      col[j] += x;
    }
  for (int i = (1); i <= (n); i++) rows.insert(-row[i]);
  for (int i = (1); i <= (m); i++) cols.insert(-col[i]);
  long long srow = 0, scol = 0;
  for (int i = (1); i <= (k); i++) {
    {
      long long tem = -(*rows.begin());
      rows.erase(rows.begin());
      rows.insert(-(tem - m * p));
      srow += tem;
      sumrow[i] = srow;
    }
    {
      long long tem = -(*cols.begin());
      cols.erase(cols.begin());
      cols.insert(-(tem - n * p));
      scol += tem;
      sumcol[i] = scol;
    }
  }
  long long ans = -1e18;
  for (int i = (0); i <= (k); i++) {
    long long cur = sumrow[i] + sumcol[k - i] - (long long)i * (k - i) * p;
    ans = max(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
