#include <bits/stdc++.h>
using namespace std;
vector<long long> x1, x2;
long long n, l, w;
bool pokriva(long long x, long long z) {
  if (z < x + l) return false;
  long long p = z + x + l;
  long long q = z - x + l;
  return -w * q < p && p < w * q;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  cin >> n >> l >> w;
  for (int i = 0; i < n; i++) {
    long long x, t;
    cin >> x >> t;
    if (t == 1)
      x1.push_back(x);
    else
      x2.push_back(x);
  }
  sort(x2.begin(), x2.end());
  long long sol = 0;
  for (long long x : x1) {
    long long lo = 0, hi = (long long)x2.size() - 1, o = x2.size();
    while (lo <= hi) {
      long long j = (lo + hi) / 2;
      if (pokriva(x, x2[j])) {
        o = j;
        hi = j - 1;
      } else {
        lo = j + 1;
      }
    }
    sol += (long long)x2.size() - o;
  }
  cout << sol << '\n';
}
