#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  struct vec {
    long long x, y;
  };
  auto vec_add = [&](vec a, vec b) { return vec{a.x + b.x, a.y + b.y}; };
  auto vec_sub = [&](vec a, vec b) { return vec{a.x - b.x, a.y - b.y}; };
  auto vec_dot = [&](vec a, vec b) { return a.x * b.x + a.y * b.y; };
  auto count_dist = [&](vec a, vec b, vec c, vec d, long long dist) {
    vec x = vec_sub(c, a);
    vec y = vec_sub(vec_sub(d, b), vec_sub(c, a));
    if (vec_dot(y, y) == 0) {
      return (vec_dot(x, x) == dist * dist) ? (long long)1e16 : (long long)0;
    }
    long long v = vec_dot(x, y) * vec_dot(x, y) -
                  vec_dot(y, y) * (vec_dot(x, x) - dist * dist);
    if (v < 0) {
      return (long long)0;
    }
    if (v == 0) {
      return (-vec_dot(x, y) >= 0 && -vec_dot(x, y) < vec_dot(y, y))
                 ? (long long)1
                 : (long long)0;
    }
    if (v > 0) {
      long long l = vec_dot(x, y);
      long long r = vec_dot(y, y) + vec_dot(x, y);
      bool g = (l < 0 || l * l <= v) && (r >= 0 && v < r * r);
      bool h = (-l >= 0 && l * l >= v) && (-r < 0 || v > r * r);
      if (g && h) {
        return (long long)2;
      } else if (g || h) {
        return (long long)1;
      } else {
        return (long long)0;
      }
    }
    return (long long)-1;
  };
  long long n, d1, d2;
  cin >> n >> d1 >> d2;
  vector<vec> g(n), h(n);
  for (long long i = 0; i < n; i++) {
    cin >> g[i].x >> g[i].y >> h[i].x >> h[i].y;
  }
  g.push_back(vec(g.back())), h.push_back(vec(h.back()));
  vector<long long> zones{2};
  for (long long i = 1; i <= n; i++) {
    long long start =
        vec_dot(vec_sub(g[i - 1], h[i - 1]), vec_sub(g[i - 1], h[i - 1]));
    if (start <= d1 * d1) {
      zones.push_back(0);
    } else if (start <= d2 * d2) {
      zones.push_back(1);
    } else {
      zones.push_back(2);
    }
    long long d1_count = count_dist(g[i - 1], g[i], h[i - 1], h[i], d1);
    long long d2_count = count_dist(g[i - 1], g[i], h[i - 1], h[i], d2);
    if (d1_count != (long long)1e16 && d2_count != (long long)1e16) {
      auto d1_do = [&]() {
        if (d1_count > 0) {
          if (zones.back() == 0) {
            zones.push_back(1);
            d1_count--;
          } else if (zones.back() == 1) {
            zones.push_back(0);
            d1_count--;
          }
        }
      };
      auto d2_do = [&]() {
        if (d2_count > 0) {
          if (zones.back() == 1) {
            zones.push_back(2);
            d2_count--;
          } else if (zones.back() == 2) {
            zones.push_back(1);
            d2_count--;
          }
        }
      };
      if (d2_count == 2) {
        if (d1_count == 2) {
          d2_do();
          d1_do();
          d1_do();
          d2_do();
        } else if (d1_count == 1) {
          d2_do();
          d1_do();
          d2_do();
        } else {
          d2_do();
          d2_do();
        }
      } else if (d2_count == 1) {
        if (d1_count == 2) {
          if (zones.back() == 2) {
            d2_do();
            d1_do();
            d1_do();
          } else {
            d1_do();
            d1_do();
            d2_do();
          }
        } else if (d1_count == 1) {
          if (zones.back() == 2) {
            d2_do();
            d1_do();
          } else {
            d1_do();
            d2_do();
          }
        } else {
          d2_do();
        }
      } else {
        if (d1_count == 2) {
          d1_do();
          d1_do();
        } else if (d1_count == 1) {
          d1_do();
        } else {
        }
      }
      if (d2_count >= 2) {
        d2_do();
      }
      d1_do();
      d1_do();
      d2_do();
    }
  }
  bool f = false;
  long long o = 0;
  for (long long zone : zones) {
    if (zone == 0) {
      if (f) {
        o++;
        f = false;
      }
    }
    if (zone == 2) {
      f = true;
    }
  }
  cout << o << endl;
  return 0;
}
