#include <bits/stdc++.h>
using namespace std;
const double EPS = 0.0000001;
const double PI = acos(-1);
const long long INFLL = 0x7FFFFFFFFFFFFFFF;
const int INF = 0x7FFFFFFF;
template <typename T>
inline void next(T &num) {
  char c;
  num = 0;
  do {
    c = getchar_unlocked();
  } while (c != EOF && c == ' ' && c == '\n' && c == '\t');
  int sign = (c == '-' ? -1 : 1);
  if (c != '-') num += (c - '0');
  while ((c = getchar_unlocked()) != EOF && c != '\n' && c != '\t' &&
         c != ' ') {
    num *= 10;
    num += (c - '0');
  }
  num *= sign;
}
inline string getstr() {
  string str;
  char k;
  while ((k = getchar_unlocked()) == ' ' || k == '\n') {
    k = getchar_unlocked();
    if (k == ' ' || k == '\n')
      continue;
    else
      break;
  }
  str.push_back(k);
  while ((k = getchar_unlocked()) != EOF && k != '\n' && k != '\t' &&
         k != '\v' && k != '\0' && k != ' ')
    str.push_back(k);
  return str;
}
int n, p, k, m, t;
long long tmp1[1002], tmp2[1002], h[1000002], v[1000002];
priority_queue<long long> hor, ver;
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (int i = int(0), _b = int(n - 1); i <= _b; i++)
    for (int j = int(0), _b = int(m - 1); j <= _b; j++) {
      scanf("%d", &t);
      tmp1[i] += t;
      tmp2[j] += t;
    }
  for (int i = int(0), _b = int(n - 1); i <= _b; i++) ver.push(tmp1[i]);
  for (int j = int(0), _b = int(m - 1); j <= _b; j++) hor.push(tmp2[j]);
  for (int i = int(1), _b = int(k); i <= _b; i++) {
    long long cur = ver.top();
    ver.pop();
    v[i] = v[i - 1] + cur;
    cur -= p * m;
    ver.push(cur);
  }
  for (int j = int(1), _b = int(k); j <= _b; j++) {
    long long cur = hor.top();
    hor.pop();
    h[j] = h[j - 1] + cur;
    cur -= p * n;
    hor.push(cur);
  }
  long long ans = -INFLL;
  for (int i = int(0), _b = int(k); i <= _b; i++)
    ans = max(ans, v[i] + h[k - i] - (long long)i * (k - i) * p);
  printf("%I64d", ans);
  return 0;
}
