#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1010;
const double eps = 1e-10;
const long long MOD = 1e9 + 7;
int ipt[maxn][maxn];
long long row[maxn * maxn], col[maxn * maxn];
long long rtol[maxn], ctol[maxn];
int main() {
  int n, m, k, p;
  while (~scanf("%d%d%d%d", &n, &m, &k, &p)) {
    priority_queue<long long> r, c;
    int radd = 0, cadd = 0;
    memset(rtol, 0, sizeof(rtol)), memset(ctol, 0, sizeof(ctol));
    for (int i = (1); i <= (n); ++i)
      for (int j = (1); j <= (m); ++j) {
        scanf("%d", &ipt[i][j]);
        rtol[i] += ipt[i][j];
        ctol[j] += ipt[i][j];
      }
    for (int i = (1); i <= (n); ++i) r.push(rtol[i]);
    for (int j = (1); j <= (m); ++j) c.push(ctol[j]);
    row[0] = 0, col[0] = 0;
    for (int i = (1); i <= (k); ++i) {
      long long x = r.top(), y = c.top();
      r.pop(), c.pop();
      r.push(x - m * p);
      c.push(y - n * p);
      row[i] = row[i - 1] + x;
      col[i] = col[i - 1] + y;
    }
    long long ans = -1e18;
    for (int i = (0); i <= (k); ++i)
      ans = max(ans, row[i] + col[k - i] - (long long)i * (k - i) * p);
    cout << ans << endl;
  }
  return 0;
}
