#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  long long arr[n + 1][m + 1];
  priority_queue<long long> pq_row;
  priority_queue<long long> pq_col;
  for (long long i = 1; i <= n; ++i) {
    long long sum = 0;
    for (long long j = 1; j <= m; ++j) {
      cin >> arr[i][j];
      sum += arr[i][j];
    }
    pq_row.push(sum);
  }
  for (long long i = 1; i <= m; ++i) {
    long long sum = 0;
    for (long long j = 1; j <= n; ++j) {
      sum += arr[j][i];
    }
    pq_col.push(sum);
  }
  vector<long long> rlol, clol;
  long long c_row[k + 1];
  long long c_col[k + 1];
  for (long long i = 0; i <= k; ++i) {
    c_row[i] = 0;
    c_col[i] = 0;
  }
  for (long long i = 1; i <= k; ++i) {
    long long v1 = pq_row.top();
    c_row[i] = v1 + c_row[i - 1];
    v1 = v1 - m * p;
    pq_row.pop();
    pq_row.push(v1);
  }
  for (long long i = 1; i <= k; ++i) {
    long long v2 = pq_col.top();
    c_col[i] = v2 + c_col[i - 1];
    v2 = v2 - n * p;
    pq_col.pop();
    pq_col.push(v2);
  }
  long long sum = c_col[k];
  for (long long i = 1; i <= k; ++i) {
    sum = max(sum, (c_row[i] + c_col[k - i] - (k - i) * i * p));
  }
  cout << sum;
  return 0;
}
