#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 69, base = 1024 * 1024, mod = 1e9 + 7;
const long double eps = 1e18;
long long n, l, w, x, vel, jed, dwa, wynik;
vector<pair<long long, long long> > vek, V1;
priority_queue<long long> q;
void licz() {
  if (w == 1) return;
  while (!q.empty()) q.pop();
  sort(vek.begin(), vek.end());
  int ile = 0;
  for (int i = 0; i < vek.size(); i++) {
    x = vek[i].first;
    vel = vek[i].second;
    if (vel == 1) {
      long long nwm = x;
      nwm *= (w + 1);
      q.push(-nwm);
    } else {
      long long nwm = x + l;
      nwm *= (w - 1);
      while (q.empty() == false) {
        if (-q.top() < nwm)
          q.pop(), ile++;
        else
          break;
      }
      wynik += ile;
    }
  }
}
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> w;
  for (int i = 0; i < n; i++) {
    cin >> x >> vel;
    if (vel == -1 && x + l > 0) dwa++;
    if (vel == 1 && x < 0) jed++;
    if (x < 0 && x + l > 0) continue;
    if (x < 0) {
      V1.push_back(make_pair(-(x + l), -vel));
    }
    if (x + l > 0) {
      vek.push_back(make_pair(x, vel));
    }
  }
  wynik = jed * dwa;
  licz();
  vek = V1;
  licz();
  cout << wynik << "\n";
}
