#include <bits/stdc++.h>
using namespace std;
int a[1100][1100];
int sum1[1100];
int sum2[1100];
vector<long long> a1;
vector<long long> a2;
map<long long, int> mp;
int main() {
  int i, j, k, m, n, p;
  long long ans, tmp, tot;
  scanf("%d%d%d%d", &m, &n, &k, &p);
  memset(sum1, 0, sizeof(sum1));
  memset(sum2, 0, sizeof(sum2));
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
      sum1[i] += a[i][j];
      sum2[j] += a[i][j];
    }
  a1.clear();
  a1.push_back(0);
  mp.clear();
  for (i = 0; i < m; i++) mp[-sum1[i]]++;
  tot = 0;
  for (i = 1; i <= k; i++) {
    tmp = mp.begin()->first;
    mp[tmp]--;
    if (mp[tmp] == 0) mp.erase(tmp);
    tot -= tmp;
    a1.push_back(tot);
    tmp += p * n;
    mp[tmp]++;
  }
  a2.clear();
  a2.push_back(0);
  mp.clear();
  for (i = 0; i < n; i++) mp[-sum2[i]]++;
  tot = 0;
  for (i = 1; i <= k; i++) {
    tmp = mp.begin()->first;
    mp[tmp]--;
    if (mp[tmp] == 0) mp.erase(tmp);
    tot -= tmp;
    a2.push_back(tot);
    tmp += p * m;
    mp[tmp]++;
  }
  ans = (-1LL << 60);
  for (i = 0; i <= k; i++) {
    tmp = (long long)-i * (k - i) * p;
    tmp += a1[i];
    tmp += a2[k - i];
    if (tmp > ans) ans = tmp;
  }
  cout << ans << endl;
  return 0;
}
