#include <bits/stdc++.h>
using namespace std;
const int MN = 100010;
int N, L, W;
vector<int> P, Q;
bool check(int a, int b) {
  if (Q[b] < 0) {
    if (W <= 1) return false;
    return (double)-P[a] / (W + 1) > (double)-(Q[b] + L) / (W - 1) + 1e-9;
  } else if (P[a] >= 0) {
    if (W <= 1) return false;
    return (double)-P[a] / (-W + 1) + 1e-9 < (double)-(Q[b] + L) / (-W - 1);
  } else
    return true;
}
int main() {
  scanf("%d %d %d", &N, &L, &W);
  for (int i = 0; i < N; i++) {
    int x, v;
    scanf("%d %d", &x, &v);
    if (v == 1)
      P.push_back(x);
    else
      Q.push_back(x);
  }
  sort(P.begin(), P.end());
  sort(Q.begin(), Q.end());
  long long ans = 0;
  int pos = 0;
  for (int i = 0; i < Q.size(); i++) {
    while (pos < P.size() && P[pos] < Q[i]) {
      pos++;
    }
    if (Q[i] < 0 && 0 < Q[i] + L) {
      ans += pos;
      continue;
    }
    int s = 0, e = pos - 1, p = -1;
    while (s <= e) {
      int m = (s + e) >> 1;
      if (check(m, i)) {
        p = m;
        s = m + 1;
      } else
        e = m - 1;
    }
    ans += p + 1;
  }
  printf("%lld", ans);
}
