#include <bits/stdc++.h>
using namespace std;
clock_t __stt;
inline void TStart() { __stt = clock(); }
inline void TReport() {
  cerr << fixed << setprecision(3) << "\nCurrent Case Taken Time : "
       << (double)(clock() - __stt) / CLOCKS_PER_SEC << "sec\n";
}
template <typename T>
T MIN(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
T ABS(T a) {
  return a > 0 ? a : (-a);
}
template <typename T>
void UMIN(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
void UMAX(T &a, T b) {
  if (b > a) a = b;
}
int n, m, d, p, x[3005], y[3005], per[3005];
long long res;
int occ[3005], nx[3005], pr[3005], nxP[3005], ldlt[3005], plen, curdlt, lastzs;
pair<int, int> pts[3005];
int alen, arr[25];
void decocc(int x) {
  int i, j, k;
  --occ[x];
  if (!occ[x]) {
    if (pr[x] != -1) {
      nx[pr[x]] = nx[x];
    }
    if (nx[x] != -1) {
      pr[nx[x]] = pr[x];
    }
  }
  alen = 0;
  for (i = x, j = 0; i != -1 && j < p; i = pr[i]) {
    j += occ[i];
    arr[alen++] = i;
  }
  reverse(arr, arr + alen);
  for (i = nx[x], j = occ[x]; i != -1 && j < p; i = nx[i]) {
    j += occ[i];
    arr[alen++] = i;
  }
  int ptr = 0, sum = 0;
  for (i = 0; i < alen; ++i) {
    if (i) sum -= occ[arr[i - 1]];
    if (!occ[arr[i]]) {
      curdlt -= ldlt[arr[i]];
      nxP[arr[i]] = -1;
      continue;
    }
    while ((ptr <= i || sum < p) && ptr < alen) {
      sum += occ[arr[ptr++]];
    }
    int d = arr[i], tar = arr[ptr - 1];
    if (sum < p) tar = (nx[tar] == -1 ? n : nx[tar]);
    UMAX(nxP[d], tar);
    curdlt -= ldlt[d];
    ldlt[d] = (d - pr[d]) * (nxP[d] - d) + (d - pr[d]) * (d - pr[d] - 1) / 2;
    curdlt += ldlt[d];
  }
}
void solve(int L) {
  int i, j, k;
  plen = 0;
  for (i = 0; i < d; ++i) {
    if (y[per[i]] >= L) pts[plen++] = make_pair(x[per[i]], y[per[i]]);
  }
  memset(occ, 0, sizeof(occ));
  memset(nxP, -1, sizeof(nxP));
  memset(pr, -1, sizeof(pr));
  for (i = 0; i < plen; ++i) {
    ++occ[pts[i].first];
  }
  nx[n - 1] = -1;
  for (i = n - 2; i >= 0; --i) {
    if (occ[i + 1])
      nx[i] = i + 1;
    else
      nx[i] = nx[i + 1];
  }
  curdlt = 0;
  for (i = 0; i < n; ++i) {
    if (!occ[i]) continue;
    if (nx[i] != -1) {
      pr[nx[i]] = i;
    }
    for (j = i, k = 0; j != -1; j = nx[j]) {
      k += occ[j];
      if (k >= p) {
        nxP[i] = j;
        break;
      }
    }
    if (j == -1) nxP[i] = n;
    ldlt[i] = (i - pr[i]) * (nxP[i] - i) + (i - pr[i]) * (i - pr[i] - 1) / 2;
    curdlt += ldlt[i];
  }
  for (lastzs = 0; lastzs < n; ++lastzs) {
    if (occ[n - 1 - lastzs]) break;
  }
  for (i = m - 1; i >= L; --i) {
    res += (long long)((n * (n + 1)) / 2) - (long long)curdlt -
           (long long)((lastzs * (lastzs + 1)) / 2);
    while (plen && pts[plen - 1].second >= i) {
      decocc(pts[--plen].first);
    }
    for (; lastzs < n; ++lastzs) {
      if (occ[n - 1 - lastzs]) break;
    }
  }
}
bool cmp(int A, int B) { return y[A] < y[B]; }
int main() {
  int i, j, k;
  scanf("%d%d%d%d", &n, &m, &d, &p);
  for (i = 0; i < d; ++i) {
    scanf("%d%d", x + i, y + i);
    --x[i];
    --y[i];
    per[i] = i;
  }
  sort(per, per + d, cmp);
  for (i = 0; i < m; ++i) {
    solve(i);
  }
  printf("%I64d\n", res);
  return 0;
}
