#include <bits/stdc++.h>
using namespace std;
long long s[1100];
priority_queue<long long> s0;
priority_queue<long long> l0;
long long l[1100];
long long ss[1000001];
long long ll[1000001];
int a, n, m;
long long k, p;
long long ans = -9223372036854775807LL;
int main() {
  cin >> n >> m >> k >> p;
  for (int(i) = (0); i < (n); ++(i))
    for (int(j) = (0); j < (m); ++(j)) {
      cin >> a;
      l[i] += a;
      s[j] += a;
    }
  for (int(i) = (0); i < (n); ++(i)) l0.push(l[i]);
  for (int(i) = (0); i < (m); ++(i)) s0.push(s[i]);
  for (int(i) = (1); i < (k + 1); ++(i)) {
    ss[i] = ss[i - 1] + s0.top();
    ll[i] = ll[i - 1] + l0.top();
    s0.push(s0.top() - p * n);
    l0.push(l0.top() - p * m);
    s0.pop();
    l0.pop();
  }
  for (int(i) = (0); i < (k + 1); ++(i))
    ans = max(ans, ss[i] + ll[k - i] - p * i * (k - i));
  cout << ans;
  return 0;
}
