#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int MAXK = 1000010;
int n, m, k, p, a[N][N], row[N], col[N];
long long ans1[MAXK], ans2[MAXK];
multiset<long long> Unis;
void solve(long long *ans, int n, int *a, int dta) {
  Unis.clear();
  for (int i = 1; i <= n; ++i) {
    Unis.insert(-a[i]);
  }
  long long now = 0;
  for (int kk = 1; kk <= k; ++kk) {
    long long val = *Unis.begin();
    now += val;
    Unis.erase(Unis.begin());
    Unis.insert(val + dta);
    ans[kk] = -now;
  }
}
int main() {
  scanf("%d %d %d %d", &n, &m, &k, &p);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      scanf("%d", &a[i][j]);
      row[i] += a[i][j];
      col[j] += a[i][j];
    }
  solve(ans1, n, row, p * m);
  solve(ans2, m, col, p * n);
  long long zans = -1e18;
  for (int i = 0; i <= k; ++i) {
    zans = max(zans, ans1[i] + ans2[k - i] - (long long)i * (k - i) * p);
  }
  cout << zans << endl;
}
