#include <bits/stdc++.h>
using namespace std;
void test_case() {
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  long long grid[n][m];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> grid[i][j];
  }
  priority_queue<long long> rpq, cpq;
  for (long long i = 0; i < n; i++) {
    long long sum = 0;
    for (long long j = 0; j < m; j++) sum += grid[i][j];
    rpq.push(sum);
  }
  for (long long j = 0; j < m; j++) {
    long long sum = 0;
    for (long long i = 0; i < n; i++) sum += grid[i][j];
    cpq.push(sum);
  }
  long long row[k + 1], col[k + 1];
  row[0] = 0;
  col[0] = 0;
  for (long long i = 1; i <= k; i++) {
    row[i] = rpq.top();
    row[i] += row[i - 1];
    long long a = rpq.top();
    rpq.pop();
    rpq.push(a - p * m);
  }
  for (long long i = 1; i <= k; i++) {
    col[i] = cpq.top();
    col[i] += col[i - 1];
    long long a = cpq.top();
    cpq.pop();
    cpq.push(a - p * n);
  }
  long long ans = -10000000000000000;
  for (long long i = 0; i <= k; i++) {
    long long temp = row[i] + col[k - i] - i * (k - i) * p;
    ans = max(ans, temp);
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) test_case();
  return 0;
}
