#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int maxm = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const long long LINF = 3e17 + 1;
const int mod = 1e9 + 7;
inline int read() {
  register int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
long long g[maxn][maxn], row[maxn], col[maxn], L[maxn * maxn], R[maxn * maxn];
int main() {
  ;
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long n, m, k, q;
  cin >> n >> m >> k >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> g[i][j];
      row[i] += g[i][j];
      col[j] += g[i][j];
    }
  priority_queue<long long> q1, q2;
  for (int i = 1; i <= n; i++) q1.push(row[i]);
  for (int i = 1; i <= m; i++) q2.push(col[i]);
  for (int i = 1; i <= k; i++) {
    long long t = q1.top();
    q1.pop();
    L[i] = L[i - 1] + t;
    t -= m * q;
    q1.push(t);
    t = q2.top();
    q2.pop();
    R[i] = R[i - 1] + t;
    t -= n * q;
    q2.push(t);
  }
  long long ans = -(1ll << 60);
  for (int i = 0; i <= k; i++) {
    ans = max(ans, L[i] + R[k - i] - 1ll * i * (k - i) * q);
  }
  cout << ans << endl;
  return 0;
}
