#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, k, p, sum = 0, x;
  cin >> n >> m >> k >> p;
  long long int a[n][m];
  priority_queue<long long int> pqr, pqs;
  for (long long int i = 0; i < n; i++) {
    sum = 0;
    for (long long int j = 0; j < m; j++) {
      cin >> a[i][j];
      sum += a[i][j];
    }
    pqr.push(sum);
  }
  for (long long int j = 0; j < m; j++) {
    sum = 0;
    for (long long int i = 0; i < n; i++) {
      sum += a[i][j];
    }
    pqs.push(sum);
  }
  vector<long long int> v1, v2;
  v1.push_back(0);
  v2.push_back(0);
  for (long long int i = 0; i < k; i++) {
    x = pqr.top();
    pqr.pop();
    v1.push_back(x);
    x -= m * p;
    pqr.push(x);
  }
  for (long long int i = 0; i < k; i++) {
    x = pqs.top();
    pqs.pop();
    v2.push_back(x);
    x -= n * p;
    pqs.push(x);
  }
  for (long long int i = 1; i <= k; i++) {
    v1[i] += v1[i - 1];
    v2[i] += v2[i - 1];
  }
  long long int ans = -1e+18;
  for (long long int i = 0; i <= k; i++) {
    ans = max(ans, v1[i] + v2[k - i] - (k - i) * i * p);
  }
  cout << ans << endl;
}
