#include <bits/stdc++.h>
using namespace std;
priority_queue<int> q;
int a[1010][1010], n, m, k, p;
long long an1[1000010];
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]);
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; i++) {
    int sumx = 0;
    for (int j = 1; j <= m; j++) sumx += a[i][j];
    q.push(sumx);
  }
  for (int i = 1; i <= k; i++) {
    int d = q.top();
    q.pop();
    an1[i] = an1[i - 1] + d;
    q.push(d - p * m);
  }
  while (!q.empty()) q.pop();
  for (int j = 1; j <= m; j++) {
    int sumy = 0;
    for (int i = 1; i <= n; i++) sumy += a[i][j];
    q.push(sumy);
  }
  long long an2 = 0, an = an1[k];
  for (int i = 1; i <= k; i++) {
    int d = q.top();
    q.pop();
    an2 += d;
    an = max(an, an1[k - i] + an2 - (long long)i * (k - i) * p);
    q.push(d - p * n);
  }
  cout << an;
  return 0;
}
