#include <bits/stdc++.h>
using namespace std;
struct Node {
  int index;
  long long sum;
  Node(int idx = 0, long long su = 0) : index(idx), sum(su) {}
  bool operator<(const Node& a) const { return sum < a.sum; }
};
int main() {
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  vector<vector<int> > a(n, vector<int>(m, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  vector<Node> rowSum(n), colSum(m);
  for (int i = 0; i < n; ++i) {
    long long sum = 0;
    for (int j = 0; j < m; ++j) sum += a[i][j];
    rowSum[i] = Node(i, sum);
  }
  for (int j = 0; j < m; ++j) {
    long long sum = 0;
    for (int i = 0; i < n; ++i) sum += a[i][j];
    colSum[j] = Node(j, sum);
  }
  priority_queue<Node> que;
  vector<long long> rowRes(k + 1, 0), colRes(k + 1, 0);
  for (int i = 0; i < n; ++i) que.push(rowSum[i]);
  int cnt = 0;
  long long res = 0;
  while (!que.empty() && cnt < k) {
    Node row = que.top();
    que.pop();
    cnt++;
    res += row.sum;
    rowRes[cnt] = res;
    row.sum -= m * p;
    que.push(row);
  }
  que = priority_queue<Node>();
  for (int i = 0; i < m; ++i) que.push(colSum[i]);
  cnt = 0;
  res = 0;
  while (!que.empty() && cnt < k) {
    Node col = que.top();
    que.pop();
    cnt++;
    res += col.sum;
    colRes[cnt] = res;
    col.sum -= n * p;
    que.push(col);
  }
  long long maxRes = -1e18;
  for (int i = 0; i <= k; ++i) {
    maxRes = max(maxRes, rowRes[i] + colRes[k - i] - i * (k - i) * p);
  }
  cout << maxRes << endl;
}
