#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, l, w, x, k;
int n1, n2;
int v1[N], v2[N];
long long ans;
int main() {
  scanf("%d%d%d", &n, &l, &w);
  while (n--) {
    scanf("%d%d", &x, &k);
    if (k == 1)
      v1[++n1] = x;
    else
      v2[++n2] = x;
  }
  sort(v1 + 1, v1 + n1 + 1);
  sort(v2 + 1, v2 + n2 + 1);
  for (int i = 1; i <= n1; i++) {
    if (w == 1 && v1[i] >= 0) break;
    if (v1[i] < 0) {
      int pp = (int)((long long)v1[i] * (w - 1) / (w + 1) - l);
      if ((long long)v1[i] * (w - 1) % (w + 1) == 0) pp++;
      int p = lower_bound(v2 + 1, v2 + n2 + 1, pp) - v2;
      ans += n2 - p + 1;
    } else if (w > 1) {
      int pp = (int)((long long)v1[i] * (w + 1) / (w - 1) - l + 1);
      int p = lower_bound(v2 + 1, v2 + n2 + 1, pp) - v2;
      ans += n2 - p + 1;
    }
  }
  for (int i = 1; i <= n2; i++) {
    if (w == 1 && v2[i] <= 0) continue;
    int p = upper_bound(v2 + i + 1, v2 + n2 + 1, v2[i] + l - 1) - v2 - 1;
    ans += p - i;
  }
  printf("%lld\n", ans);
}
