#include <bits/stdc++.h>
using namespace std;
long long divdw(long long a, long long b) {
  if (!b) return 1e9 * (a < 0 ? -1 : 1);
  if (a % b < 0) a -= (b + a % b);
  return a / b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, l, wmax;
  cin >> n >> l >> wmax;
  vector<long long> neg, pos;
  for (int i = 0; i < n; i++) {
    long long x, v;
    cin >> x >> v;
    if (v == -1)
      neg.push_back(x);
    else
      pos.push_back(x);
  }
  sort(neg.begin(), neg.end());
  sort(pos.begin(), pos.end());
  long long ans = 0;
  for (int i = 0; i < neg.size(); i++) {
    long long r1 = divdw((wmax + 1) * (neg[i] + l) - 1, (wmax - 1));
    long long l2 = -(neg[i] + l),
              r2 =
                  min(neg[i], divdw((wmax - 1) * (neg[i] + l) - 1, (wmax + 1)));
    auto itl2 = lower_bound(pos.begin(), pos.end(), l2);
    ans += upper_bound(pos.begin(), itl2, r1) - pos.begin();
    ans += upper_bound(itl2, pos.end(), r2) - itl2;
  }
  cout << ans << "\n";
  return 0;
}
