#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
void display(vector<int> v) {
  cout << '[';
  for (int i = 0; i < v.size(); i++)
    cout << v[i] << (i != v.size() - 1 ? ", " : "");
  cout << ']' << '\n';
}
void display(vector<long long> v) {
  cout << '[';
  for (int i = 0; i < v.size(); i++)
    cout << v[i] << (i != v.size() - 1 ? ", " : "");
  cout << ']' << '\n';
}
void display(vector<string> v) {
  cout << '[';
  for (int i = 0; i < v.size(); i++)
    cout << v[i] << (i != v.size() - 1 ? ", " : "");
  cout << ']' << '\n';
}
const long long M = 1e4 + 2, N = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k, p;
  cin >> n >> m >> k >> p;
  vector<vector<int> > t(n, vector<int>(m, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> t[i][j];
  priority_queue<long long> r, c;
  for (int i = 0; i < n; i++) {
    long long p = 0;
    for (int j = 0; j < m; j++) p += t[i][j];
    r.push(p);
  }
  for (int j = 0; j < m; j++) {
    long long p = 0;
    for (int i = 0; i < n; i++) p += t[i][j];
    c.push(p);
  }
  vector<long long> dpr(k + 1), dpc(k + 1);
  for (int i = 1; i < k + 1; i++) {
    dpr[i] = dpr[i - 1] + r.top();
    r.push(r.top() - p * m);
    r.pop();
    dpc[i] = dpc[i - 1] + c.top();
    c.push(c.top() - p * n);
    c.pop();
  }
  long long sum = -1e18;
  for (int i = 0; i < k + 1; i++) {
    int cx = i;
    int rx = k - i;
    long long a = dpc[cx] + dpr[rx] - (long long)cx * p * rx;
    sum = max(sum, a);
  }
  cout << sum;
  return 0;
}
