#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  long long k, p, d;
  cin >> n >> m >> k >> p;
  vector<long long> a(n, 0), b(m, 0);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> d;
      a[i] += d;
      b[j] += d;
    }
  multiset<long long> aa, bb;
  for (long long i = 0; i < n; i++) aa.insert(-a[i]);
  for (long long j = 0; j < m; j++) bb.insert(-b[j]);
  vector<long long> res1(k + 1, 0), res2(k + 1, 0);
  for (long long i = 0; i < k; i++) {
    d = *aa.begin();
    res1[i + 1] = -d + res1[i];
    aa.erase(aa.begin());
    d += p * m;
    aa.insert(d);
    d = *bb.begin();
    res2[i + 1] = -d + res2[i];
    bb.erase(bb.begin());
    d += p * n;
    bb.insert(d);
  }
  long long res = res1[k];
  for (long long i = 0; i < k + 1; i++) {
    res = max(res, res1[i] + res2[k - i] - p * i * (k - i));
  }
  cout << res;
}
