#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
long long powmod(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = powmod(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long modif(long long x, long long m) { return (powmod(x, m - 2, m)); }
bool fa(vector<long long> &x, vector<long long> &y) { return x[0] < y[0]; }
bool fa1(vector<long long> &x, vector<long long> &y) { return x[1] < y[1]; }
bool f1(pair<long long, long long> &x, pair<long long, long long> &y) {
  return x.second > y.second;
}
bool f2(pair<long long, long long> &x, pair<long long, long long> &y) {
  return x.first > y.first;
}
bool f3(long long &x, long long &y) { return x > y; }
const long long maxn = 2e5 + 2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k, p;
  cin >> n >> m >> k >> p;
  long long b[n][m];
  for (int i = 0; i < n; i++) {
    for (int t = 0; t < m; t++) cin >> b[i][t];
  }
  set<pair<long long, long long>, greater<pair<long long, long long> > > a1, c1;
  for (int i = 0; i < n; i++) {
    long long h = 0;
    for (int t = 0; t < m; t++) {
      h += b[i][t];
    }
    a1.insert(make_pair(h, i));
  }
  for (int i = 0; i < m; i++) {
    long long h = 0;
    for (int t = 0; t < n; t++) {
      h += b[t][i];
    }
    c1.insert(make_pair(h, i));
  }
  stack<long long> c;
  vector<long long> a;
  long long ans = -1e18;
  long long cur = 0;
  for (int i = 0; i < k; i++) {
    pair<long long, long long> x = *a1.begin();
    a1.erase(a1.begin());
    a.push_back(x.first);
    cur += x.first;
    x.first -= m * p;
    a1.insert(x);
  }
  ans = max(ans, cur);
  cur = 0;
  long long re = 0;
  for (int i = 0; i < k; i++) {
    pair<long long, long long> x = *c1.begin();
    c1.erase(c1.begin());
    cur += x.first;
    c.push(x.first);
    x.first -= n * p;
    re -= p;
    c1.insert(x);
  }
  cout << endl;
  long long f = 0;
  ans = max(ans, cur);
  for (int i = 0; i < k; i++) {
    cur -= c.top();
    c.pop();
    cur += a[i];
    re += p;
    ans = max(ans, re * (i + 1) + cur);
  }
  cout << ans << endl;
  return 0;
}
