#include <bits/stdc++.h>
using namespace std;
long long ans;
int n, l, w, x, pn;
vector<int> pos, neg;
int cal(long long a, int b) {
  if (b == 0) return (a > 0 ? INT_MAX : -INT_MAX);
  if (a < 0) {
    if (a % b != 0) return (a / b - 1);
  }
  return a / b;
}
int main() {
  ios::sync_with_stdio(false);
  scanf("%d%d%d", &n, &l, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &pn);
    if (pn == -1)
      neg.push_back(x);
    else
      pos.push_back(x);
  }
  sort(neg.begin(), neg.end());
  sort(pos.begin(), pos.end());
  for (int i = 0; i < neg.size(); i++) {
    int v = neg[i];
    auto now = lower_bound(pos.begin(), pos.end(), -v - l);
    int max1 = cal((long long)(v + l) * (w + 1) - 1, w - 1);
    int max2 = cal((long long)(v + l) * (w - 1) - 1, w + 1);
    ans += (upper_bound(pos.begin(), now, max1) - pos.begin()) +
           (upper_bound(now, pos.end(), min(max2, v)) - now);
  }
  cout << ans << endl;
  return 0;
}
