#include <bits/stdc++.h>
using std::cerr;
using std::cin;
using std::max;
using std::min;
int n, m, Max, a, b, An, Bn, A[100005], B[100005];
long long ans;
int main() {
  scanf("%d%d%d", &n, &m, &Max);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a, &b), b < 0 ? A[++An] = a : B[++Bn] = a;
  std::sort(A + 1, A + 1 + An), std::sort(B + 1, B + 1 + Bn);
  for (int i = 1, tmp, pos; i <= An; i++) {
    if (Max > 1)
      tmp = ceil((long long)(A[i] + m) * (Max + 1) * 1. / (Max - 1)) - 1;
    else
      tmp = A[i] + m > 0 ? 1e9 : -1e9;
    tmp = min(tmp, -A[i] - m - 1);
    ans += std::upper_bound(B + 1, B + 1 + Bn, tmp) - B - 1;
    tmp = ceil((long long)(A[i] + m) * (Max - 1) * 1. / (Max + 1)) - 1,
    tmp = min(tmp, A[i] - 1);
    pos = std::lower_bound(B + 1, B + 1 + Bn, -A[i] - m) - B;
    ans += std::upper_bound(B + pos, B + 1 + Bn, tmp) - B - pos;
  }
  std::cout << ans << "\n";
  return 0;
}
