#include <bits/stdc++.h>
using namespace std;
int n;
long long l, w;
vector<long long> vr, vl;
long long ans;
bool check(long long xi, long long xj) {
  if (xi > xj) return false;
  long long t = (xj - xi);
  long long d = (xi + xj);
  if (d < 0 && d > 2 * -l) return true;
  if (d < 0) d += 2 * l;
  return (t + l) * w > abs(d) + l;
}
int lower_bound(vector<long long>& vec, long long xi) {
  if (vec.size() == 0) return -1;
  int lb = 0, ub = vec.size() - 1;
  if (check(xi, vec[lb])) return 0;
  if (!check(xi, vec[ub])) return -1;
  while (lb + 1 < ub) {
    int M = (lb + ub) / 2;
    if (check(xi, vec[M]))
      ub = M;
    else
      lb = M;
  }
  return ub;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> l >> w;
  long long x;
  int vel;
  for (int i = 1; i <= n; i++) {
    cin >> x >> vel;
    if (vel == 1)
      vr.push_back(x);
    else
      vl.push_back(x);
  }
  sort(vl.begin(), vl.end());
  for (auto xi : vr) {
    int lb = lower_bound(vl, xi);
    if (lb != -1) ans += vl.size() - lb;
  }
  cout << ans << '\n';
  return 0;
}
