#include <bits/stdc++.h>
using namespace std;
int const lim = 1e3;
int inp[lim + 3][lim + 3];
multiset<long long> col, row;
long long ans_col[lim * lim + 3], ans_row[lim * lim + 3];
int main() {
  int n, m, k, q;
  cin >> n >> m >> k >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &inp[i][j]);
  for (int i = 0; i < n; i++) {
    long long cur = 0;
    for (int j = 0; j < m; j++) cur += inp[i][j];
    row.insert(cur);
  }
  for (int j = 0; j < m; j++) {
    long long cur = 0;
    for (int i = 0; i < n; i++) cur += inp[i][j];
    col.insert(cur);
  }
  for (int i = 1; i <= k; i++) {
    multiset<long long>::iterator it = col.end();
    it--;
    long long cur = *it;
    col.erase(it);
    ans_col[i] = ans_col[i - 1] + cur;
    cur -= n * q;
    col.insert(cur);
  }
  for (int i = 1; i <= k; i++) {
    multiset<long long>::iterator it = row.end();
    it--;
    long long cur = *it;
    row.erase(it);
    ans_row[i] = ans_row[i - 1] + cur;
    cur -= m * q;
    row.insert(cur);
  }
  long long mx = -1e18;
  for (int i = 0; i <= k; i++) {
    mx = max(mx, ans_col[i] + ans_row[k - i] - (1ll * i * q * (k - i)));
  }
  cout << mx << endl;
}
