#include <bits/stdc++.h>
inline int read() {
  register int x = 0;
  register char ch = getchar();
  register bool f = 0;
  for (; ch < '0' || ch > '9'; ch = getchar()) f |= (ch == '-');
  for (; 47 < ch && ch < 58; ch = getchar())
    x = (x << 1) + (x << 3) + (ch ^ 48);
  return f ? -x : x;
}
int L[100010], R[100010], n, l, w;
long long ans;
int main() {
  n = read();
  l = read();
  w = read();
  for (register int i = 1; i <= n; ++i) {
    int x = read(), v = read();
    if (v == 1)
      R[++*R] = x;
    else
      L[++*L] = x;
  }
  std::sort(L + 1, L + *L + 1);
  std::sort(R + 1, R + *R + 1);
  register int lft = 1, rht = *L;
  for (register int i = 1; i <= *R; ++i) {
    if (lft <= rht) {
      while (lft <= *L)
        if (((L[lft] + R[i] + l) < 0
                 ? -(L[lft] + R[i] + l)
                 : (L[lft] + R[i] + l)) < 1ll * (L[lft] - R[i] + l) * w)
          break;
        else
          ++lft;
      while (rht > 0)
        if (((L[rht] + R[i] + l) < 0
                 ? -(L[rht] + R[i] + l)
                 : (L[rht] + R[i] + l)) < 1ll * (L[rht] - R[i] + l) * w)
          break;
        else
          --rht;
    }
    (rht - lft > -1) && (ans += rht - lft + 1);
  }
  printf("%I64d\n", ans);
  return 0;
}
