#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int MAXK = 1000010;
const long long INF = 1LL << 60;
int arr[MAXN][MAXN];
long long dp1[MAXK], dp2[MAXK];
int main() {
  int n, m, k, p;
  while (scanf("%d%d%d%d", &n, &m, &k, &p) != EOF) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        scanf("%d", &arr[i][j]);
      }
    }
    priority_queue<long long> row;
    for (int i = 1; i <= n; ++i) {
      long long sum = 0;
      for (int j = 1; j <= m; ++j) {
        sum += arr[i][j];
      }
      row.push(sum);
    }
    priority_queue<long long> col;
    for (int j = 1; j <= m; ++j) {
      long long sum = 0;
      for (int i = 1; i <= n; ++i) {
        sum += arr[i][j];
      }
      col.push(sum);
    }
    dp1[0] = dp2[0] = 0LL;
    for (int i = 1; i <= k; ++i) {
      long long sum = row.top();
      row.pop();
      dp1[i] = dp1[i - 1] + sum;
      sum -= (long long)p * m;
      row.push(sum);
    }
    for (int i = 1; i <= k; ++i) {
      long long sum = col.top();
      col.pop();
      dp2[i] = dp2[i - 1] + sum;
      sum -= (long long)p * n;
      col.push(sum);
    }
    long long ret = -INF;
    for (int i = 0; i <= k; ++i) {
      ret = max(ret, dp1[i] + dp2[k - i] - (long long)i * (k - i) * p);
    }
    printf("%I64d\n", ret);
  }
  return 0;
}
