#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  long long int n, l, w;
  cin >> n >> l >> w;
  long long int pom, pom2;
  vector<long long int> left, right;
  for (long long int i = (0); i < (long long int)(n); ++i) {
    cin >> pom >> pom2;
    if (pom2 == 1) {
      left.push_back(pom);
    } else {
      right.push_back(pom + l);
    }
  }
  sort(right.begin(), right.end());
  sort(left.begin(), left.end());
  long long int start = 0, sum = 0;
  for (long long int i = (0); i < (long long int)(left.size()); ++i) {
    while (start < right.size() && left[i] > right[start]) start++;
    if (start == right.size()) break;
    long long int lo = start, hi = right.size() - 1, mid = start;
    while (lo < hi) {
      mid = (lo + hi) / 2;
      if (abs(left[i] + right[mid]) >= w * (right[mid] - left[i]))
        lo = mid + 1;
      else
        hi = mid;
    }
    if (abs(left[i] + right[lo]) >= w * (right[lo] - left[i])) lo++;
    sum += right.size() - lo;
  }
  cout << sum << endl;
  return 0;
}
