#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  vector<vector<long long> > a(n, vector<long long>(m, 0));
  for (int z = 0; z < n; ++z)
    for (int i = 0; i < (int)a[z].size(); ++i) cin >> a[z][i];
  ;
  multiset<long long> R, C;
  for (int i = 0; i < n; ++i) {
    long long sum = 0;
    for (int j = 0; j < m; ++j) sum += a[i][j];
    R.insert(sum);
  }
  for (int j = 0; j < m; ++j) {
    long long sum = 0;
    for (int i = 0; i < n; ++i) sum += a[i][j];
    C.insert(sum);
  }
  vector<long long> ROW_MAX(k + 1, 0), COL_MAX(k + 1, 0);
  for (int l = 1; l <= k; ++l) {
    auto iter = --R.end();
    ROW_MAX[l] = ROW_MAX[l - 1] + *iter;
    R.insert(*iter - m * p);
    R.erase(iter);
  }
  for (int l = 1; l <= k; ++l) {
    auto iter = --C.end();
    COL_MAX[l] = COL_MAX[l - 1] + *iter;
    C.insert(*iter - n * p);
    C.erase(iter);
  }
  long long ans = -LINF;
  for (long long l = 0; l <= k; ++l)
    ans = max(ans, ROW_MAX[l] + COL_MAX[k - l] - (k - l) * (l * p));
  cout << ans << '\n';
  exit(0);
}
