#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
int main() {
  long long int var = -inf;
  long long int n, m, k, p;
  cin >> n >> m >> k >> p;
  vector<vector<long long int>> in(n, vector<long long int>(m));
  for (int i = 0; i < n; i++) {
    ;
    for (long long int j = 0; j < m; j++) cin >> in[i][j];
    ;
  }
  set<pair<long long int, long long int>> row, column;
  for (int i = 0; i < n; i++) {
    long long int sum = 0;
    for (int j = 0; j < m; j++) {
      sum += in[i][j];
    }
    row.insert(pair<long long int, long long int>(sum, i));
  }
  for (int i = 0; i < m; i++) {
    long long int sum = 0;
    for (int j = 0; j < n; j++) {
      sum += in[j][i];
    }
    column.insert(pair<long long int, long long int>(sum, i));
  }
  set<pair<long long int, long long int>> answer, answer2;
  long long int sum = 0;
  long long int ans = -inf;
  while ((int)((answer).size()) < k) {
    auto it = row.end();
    it--;
    answer.insert(pair<long long int, long long int>((*it).first, var));
    var++;
    sum += it->first;
    pair<long long int, long long int> temp(it->first - m * p, it->second);
    row.erase(it);
    row.insert(temp);
  }
  ans = max(ans, sum);
  long long int rcount = k;
  long long int ccount = 0;
  while (ccount < k) {
    auto it1 = answer.begin();
    auto it2 = column.end();
    it2--;
    sum += it2->first - it1->first;
    sum += (ccount * rcount) * p;
    rcount--;
    ccount++;
    sum -= (ccount * rcount) * p;
    ans = max(ans, sum);
    answer.erase(it1);
    var++;
    pair<long long int, long long int> temp(it2->first - n * p, it2->second);
    column.erase(it2);
    column.insert(temp);
  }
  cout << ans << "\n";
}
