#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };
vector<int> leftx, rightx;
int get(long long x, int l, long long w) {
  int mn = -1, mx = rightx.size(), m;
  while (mx - mn > 1) {
    m = (mx + mn) / 2;
    if ((rightx[m] + l) * (1 + w) > x * (w - 1)) {
      mx = m;
    } else {
      mn = m;
    }
  }
  mx = rightx.size();
  while (mx - mn > 1) {
    m = (mx + mn) / 2;
    if ((rightx[m] + l) * (1 - w) < x * (-w - 1)) {
      mx = m;
    } else {
      mn = m;
    }
  }
  return rightx.size() - mx;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, l, w;
  cin >> n >> l >> w;
  for (int i = 0; i < n; ++i) {
    int x, v;
    cin >> x >> v;
    if (v == 1) {
      leftx.push_back(x);
    } else {
      rightx.push_back(x);
    }
  }
  sort(leftx.begin(), leftx.end());
  sort(rightx.begin(), rightx.end());
  long long ans = 0;
  for (int i = 0; i < leftx.size(); ++i) {
    ans += get(leftx[i], l, w);
  }
  cout << ans << '\n';
  return 0;
}
