#include <bits/stdc++.h>
using namespace std;
vector<long long> mvR, mvL;
long long n, l, ans, wMax;
vector<double> activeMvR;
double eps = 0.00000001, INF = 1. * 1000000000000000;
int cntInInt(double lb, double ub) {
  if (lb >= ub) {
    return 0;
  }
  int cntL1 =
      lower_bound(activeMvR.begin(), activeMvR.end(), ub) - activeMvR.begin();
  int cntL2 =
      lower_bound(activeMvR.begin(), activeMvR.end(), lb) - activeMvR.begin();
  return cntL1 - cntL2;
}
int main() {
  cin >> n >> l >> wMax;
  if (wMax == 1) {
  }
  for (int i = 0; i < n; i++) {
    int x, v;
    cin >> x >> v;
    if (v == 1) {
      mvR.push_back(x);
    } else {
      mvL.push_back(x);
    }
  }
  sort(mvR.begin(), mvR.end());
  sort(mvL.begin(), mvL.end());
  int mvRInd = 0;
  for (int i = 0; i < mvL.size(); i++) {
    int rx = mvL[i];
    int rr = mvL[i] + l;
    while (mvRInd < mvR.size() && mvR[mvRInd] < rx) {
      activeMvR.push_back(mvR[mvRInd]);
      mvRInd++;
    }
    long long w = wMax;
    double lb1 = -INF, ub1 = min(-rr * 1., rr * (1 + w) * 1. / (w - 1));
    double lb2 = -rr, ub2 = rr * (w - 1) * 1. / (w + 1);
    if (w == 1 && rr <= 0) {
      ub1 = -INF;
    }
    int cntL1 = cntInInt(lb1, ub1);
    int cntL2 = cntInInt(lb2, ub2);
    int cnt = cntL1 + cntL2;
    ans += cnt;
  }
  cout << ans << "\n";
  return 0;
}
