#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
double sqr(double a) { return a * a; }
struct Node {
  vector<int> nbr;
  int used;
  int p1, p2;
  int init, goal;
  Node() {
    p1 = p2 = 0;
    used = 0;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  long long int n, m, k, p;
  cin >> n >> m >> k >> p;
  vector<vector<long long int> > arr(n, vector<long long int>(m));
  priority_queue<long long int> r, c;
  vector<long long int> col(m), row(n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> arr[i][j];
      row[i] += arr[i][j];
      col[j] += arr[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    r.push(row[i]);
  }
  for (int i = 0; i < m; ++i) {
    c.push(col[i]);
  }
  long long int ans = -9000000000000000000LL;
  vector<long long int> a(k + 1), b(k + 1);
  for (int i = 0; i < k + 1; ++i) {
    if (!i) continue;
    a[i] = a[i - 1];
    a[i] += r.top();
    long long int t = r.top();
    r.pop();
    r.push(t - m * p);
  }
  for (int i = 0; i < k + 1; ++i) {
    if (!i) continue;
    b[i] = b[i - 1];
    b[i] += c.top();
    long long int t = c.top();
    c.pop();
    c.push(t - n * p);
  }
  for (int i = 0; i < k + 1; ++i) {
    ans = max(ans, a[i] + b[k - i] - p * i * (k - i));
  }
  cout << ans;
  return 0;
}
