#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, map<L, R> M) {
  os << "[";
  for (auto pr : M) os << pr.first << "->" << pr.second << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, unordered_map<L, R> M) {
  os << "[";
  for (auto pr : M) os << pr.first << "->" << pr.second << ",";
  return os << "]";
}
mt19937_64 mt(time(0));
struct Matrix {
  vector<vector<int>> data;
  int r, c;
  Matrix(int row, int col, bool identity = false) : r(row), c(col) {
    data.assign(row, vector<int>(col, 0));
    if (identity) {
      for (int i = 0; i < r; ++i) {
        data[i][i] = 1;
      }
    }
  }
  Matrix operator*(Matrix &other) {
    int m = r, n = c, p = other.c;
    Matrix res(m, p);
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j < p; ++j) {
        for (int k = 0; k < n; ++k) {
          res.data[i][j] += data[i][k] * other.data[k][j];
        }
      }
    }
    return res;
  }
};
vector<int> extendGcd(int a, int b) {
  if (b == 0) {
    return {1, 0, a};
  } else {
    vector<int> tmp = extendGcd(b, a % b);
    return {tmp[1], tmp[0] - (a / b) * tmp[1], tmp[2]};
  }
}
Matrix matrix_power(Matrix base, long long exp) {
  int n = base.r;
  Matrix res(n, n, true);
  while (exp) {
    if (exp & 1) {
      res = res * base;
    }
    base = base * base;
    exp >>= 1;
  }
  return res;
}
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline double dbread() {
  double X = 0, Y = 1.0;
  int w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = X * 10 + (ch ^ 48), ch = getchar();
  ch = getchar();
  while (isdigit(ch)) X += (Y /= 10) * (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
long long n, d[2];
pair<long long, long long> a[100010], b[100010];
long long res = 0;
bool first = true, large = false;
void solve(int left, int right) {
  long long p =
      a[right].first - a[left].first - (b[right].first - b[left].first);
  long long q = a[left].first - b[left].first;
  long long r =
      a[right].second - a[left].second - (b[right].second - b[left].second);
  long long s = a[left].second - b[left].second;
  long long A = p * p + r * r;
  long long B = 2 * (p * q + r * s);
  long long C = q * q + s * s;
  if (A == 0) {
    if (first) {
      if (C <= d[0] * d[0]) {
        ++res;
        first = false;
      }
    } else {
      if (C <= d[0] * d[0]) {
        if (large) {
          large = false;
          ++res;
        }
      } else if (C > d[1] * d[1]) {
        large = true;
      }
    }
  } else {
    if (B > 0) {
      if (first) {
        if (C <= d[0] * d[0]) {
          ++res;
          first = false;
          if (A + B + C > d[1] * d[1]) {
            large = true;
          }
        }
      } else {
        if (large) {
          if (C <= d[0] * d[0]) {
            large = false;
            ++res;
          }
        }
        if (A + B + C > d[1] * d[1]) {
          large = true;
        }
      }
    } else if (B < -2 * A) {
      if (first) {
        if (A + B + C <= d[0] * d[0]) {
          ++res;
          first = false;
        }
      } else {
        if (C > d[1] * d[1]) {
          large = true;
        }
        if (large) {
          if (A + B + C <= d[0] * d[0]) {
            large = false;
            ++res;
          }
        }
      }
    } else {
      if (first) {
        if (4 * A * C - B * B <= 4 * A * d[0] * d[0]) {
          first = false;
          ++res;
        }
      } else {
        if (C > d[1] * d[1]) {
          large = true;
        }
        if (large) {
          if (4 * A * C - B * B <= 4 * A * d[0] * d[0]) {
            large = false;
            ++res;
          }
        }
      }
      if (!first && A + B + C > d[1] * d[1]) {
        large = true;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  cout << fixed;
  cin >> n >> d[0] >> d[1];
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first >> a[i].second >> b[i].first >> b[i].second;
  }
  for (int i = 1; i <= n - 1; ++i) {
    solve(i, i + 1);
  }
  cout << res;
  return 0;
}
