#include <bits/stdc++.h>
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = 0; i < n; ++i) sum += v[i];
  return sum;
}
template <class T>
typename T::value_type arr_count(const T& v, int n, int t) {
  typename T::value_type count = 0;
  for (int i = 0; i < n; ++i) count += v[i] == t;
  return count;
}
template <class T>
typename T::value_type arr_maxi(const T& v, int n) {
  typename T::value_type maxi = 0;
  for (int i = 1; i < n; ++i)
    if (v[maxi] < v[i]) maxi = i;
  return maxi;
}
template <class T>
typename T::value_type arr_mini(const T& v, int n) {
  typename T::value_type mini = 0;
  for (int i = 1; i < n; ++i)
    if (v[mini] > v[i]) mini = i;
  return mini;
}
template <class T>
typename T::value_type arr_max(const T& v, int n) {
  typename T::value_type max = v[0];
  for (int i = 1; i < n; ++i)
    if (max < v[i]) max = v[i];
  return max;
}
template <class T>
typename T::value_type arr_min(const T& v, int n) {
  typename T::value_type min = v[0];
  for (int i = 1; i < n; ++i)
    if (min > v[i]) min = v[i];
  return min;
}
using namespace std;
int main() {
  priority_queue<int, vector<int>> rows;
  priority_queue<int, vector<int>> cols;
  int n, m, k, p;
  cin >> n >> m >> k >> p;
  int a[n][m];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  ;
  for (int i = 0; i < n; ++i) {
    int s = 0;
    for (int j = 0; j < m; ++j) {
      s += a[i][j];
    }
    rows.push(s);
  }
  for (int j = 0; j < m; ++j) {
    int s = 0;
    for (int i = 0; i < n; ++i) {
      s += a[i][j];
    }
    cols.push(s);
  }
  vector<long long> v1(k + 1);
  vector<long long> v2(k + 1);
  v1[0] = 0;
  v2[0] = 0;
  long long sum = 0;
  for (int i = 1; i < k + 1; ++i) {
    int t = cols.top();
    cols.pop();
    sum += t;
    t -= p * n;
    cols.push(t);
    v1[i] = sum;
  }
  sum = 0;
  for (int i = 1; i < k + 1; ++i) {
    int t = rows.top();
    rows.pop();
    sum += t;
    t -= p * m;
    rows.push(t);
    v2[i] = sum;
  }
  long long res = v1[0] + v2[k];
  for (int i = 1; i < k + 1; ++i) {
    res = max(res, v1[i] + v2[k - i] - (long long)(k - i) * i * p);
  }
  cout << res;
}
