#include <bits/stdc++.h>
long long dp[1000006][2];
int a[1005][1005];
int n, m, k, p;
using namespace std;
int main() {
  cin >> n >> m >> k >> p;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  priority_queue<int, vector<int>, less<int> > Q;
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = 0; j < m; j++) {
      sum += a[i][j];
    }
    Q.push(sum);
  }
  for (int i = 1; i <= k; i++) {
    int t = Q.top();
    dp[i][0] = dp[i - 1][0] + t;
    Q.pop();
    t -= p * m;
    Q.push(t);
  }
  for (int i = 0; i < n; i++) Q.pop();
  for (int i = 0; i < m; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      sum += a[j][i];
    }
    Q.push(sum);
  }
  for (int i = 1; i <= k; i++) {
    int t = Q.top();
    dp[i][1] = dp[i - 1][1] + t;
    Q.pop();
    t -= p * n;
    Q.push(t);
  }
  long long ans = -(1LL << 60);
  for (long long i = 0; i <= k; i++) {
    ans = max(ans, dp[i][0] + dp[k - i][1] - i * p * (k - i));
    ans = max(ans, dp[i][1] + dp[k - i][0] - i * p * (k - i));
  }
  cout << ans << endl;
}
