#include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod = (1000000007LL)) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long rsum[1005], csum[1005];
long long chooseRows[1000002], chooseCols[1000002];
int main() {
  ios_base::sync_with_stdio(0);
  int r, c, k, p;
  cin >> r >> c >> k >> p;
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) {
      long long foo;
      cin >> foo;
      rsum[i] += foo;
      csum[j] += foo;
    }
  priority_queue<long long> rpq, cpq;
  for (int i = 0; i < r; i++) rpq.push(rsum[i]);
  for (int j = 0; j < c; j++) cpq.push(csum[j]);
  chooseRows[0] = 0;
  for (int i = 1; i <= k; i++) {
    long long val = rpq.top();
    rpq.pop();
    chooseRows[i] = chooseRows[i - 1] + val;
    rpq.push(val - (long long)c * p);
  }
  chooseCols[0] = 0;
  for (int i = 1; i <= k; i++) {
    long long val = cpq.top();
    cpq.pop();
    chooseCols[i] = chooseCols[i - 1] + val;
    cpq.push(val - (long long)r * p);
  }
  long long ans = -(long long)1e15;
  for (int i = 0; i <= k; i++) {
    long long penalty = (long long)i * (k - i) * p;
    long long temp = chooseRows[i] + chooseCols[k - i] - penalty;
    ans = max(ans, temp);
  }
  cout << ans;
  return 0;
}
