#include <bits/stdc++.h>
using namespace std;
int p, q;
int a[100010], b[100010];
int main() {
  int id1 = 1;
  int id2 = 1;
  int n;
  cin >> n;
  cin >> p >> q;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (y == 1) {
      a[id1++] = x;
    } else
      b[id2++] = x;
  }
  sort(a + 1, a + id1);
  sort(b + 1, b + id2);
  id1--;
  id2--;
  for (int i = 1, j = 1; i <= id1; i++) {
    while (j <= id2 && abs(a[i] + b[j] + p) >= 1ll * q * (b[j] - a[i] + p)) {
      j++;
    }
    ans += id2 - j + 1;
  }
  cout << ans << endl;
  return 0;
}
