0 0 10 10
1
10 0 0 1.57079
0
 -88 -68 -10 -61
5
-64 -55 3.09648 0.28346
-8 -52 2.46781 0.13262
-8 -59 3.02445 0.00119
-40 90 2.37292 0.15686
-29 -34 2.73957 0.18287
0
 0 0 10 10
2
10 0 0 1.57079
10 5 0 0.7854
1
 -100000 -100000 100000 100000
1
100000 0 0 15.70796
0
 -3 -7 -14 2
5
-16 19 2.12587 0.30781
9 -19 3.27418 0.06595
-1 12 0.12414 8.82294
20 10 6.25657 0.77605
-10 17 0.29502 6.31019
5

14.142079
 7.216642
 7.071084
 2828426.5363
 0.0000

#include <bits/stdc++.h>
using namespace std;
double PositiveAtan2(double dy, double dx) {
  double ret = atan2(dy, dx);
  if (ret >= 0.0) return ret;
  return 2.0 * atan2(0.0, -1.0) + ret;
}
pair<double, double> PointToVector(pair<double, double> p1,
                                   pair<double, double> p2) {
  return make_pair(p2.first - p1.first, p2.second - p1.second);
}
double VectorAngle(pair<double, double> rotated_vec,
                   pair<double, double> target_vec) {
  double rotangle = PositiveAtan2(rotated_vec.second, rotated_vec.first);
  double tarangle = PositiveAtan2(target_vec.second, target_vec.first);
  if (tarangle >= rotangle) return tarangle - rotangle;
  return tarangle + 2.0 * atan2(0.0, -1.0) - rotangle;
}
double SegmentLength(pair<pair<double, double>, pair<double, double> > seg) {
  return sqrt((seg.first.first - seg.second.first) *
                  (seg.first.first - seg.second.first) +
              (seg.first.second - seg.second.second) *
                  (seg.first.second - seg.second.second));
}
double DistanceToLine(pair<pair<double, double>, pair<double, double> > line,
                      pair<double, double> point_x,
                      pair<double, double>* out_point = NULL) {
  pair<double, double> point_a, point_b;
  point_a = line.first;
  point_b = line.second;
  double cpx, cpy;
  double proj =
      ((point_x.first - point_a.first) * (point_b.first - point_a.first) +
       (point_x.second - point_a.second) * (point_b.second - point_a.second)) /
      ((point_b.first - point_a.first) * (point_b.first - point_a.first) +
       (point_b.second - point_a.second) * (point_b.second - point_a.second));
  cpx = point_a.first + proj * (point_b.first - point_a.first);
  cpy = point_a.second + proj * (point_b.second - point_a.second);
  if (out_point != NULL) {
    *out_point = make_pair(cpx, cpy);
  }
  return SegmentLength(make_pair(point_x, make_pair(cpx, cpy)));
}
bool IsCollinear(pair<double, double> p1, pair<double, double> p2,
                 pair<double, double> p3) {
  return abs(p1.first * p2.second + p2.first * p3.second +
             p3.first * p1.second - p1.second * p2.first -
             p2.second * p3.first - p3.second * p1.first) < 1e-8;
}
bool SegmentContainsPoint(
    pair<pair<double, double>, pair<double, double> > segment,
    pair<double, double> point) {
  if (!IsCollinear(segment.first, segment.second, point)) {
    return false;
  }
  return (
      point.first + 1e-8 >= min(segment.first.first, segment.second.first) &&
      point.first - 1e-8 <= max(segment.first.first, segment.second.first) &&
      point.second + 1e-8 >= min(segment.first.second, segment.second.second) &&
      point.second - 1e-8 <= max(segment.first.second, segment.second.second));
}
pair<double, double> ox = make_pair(1.0, 0.0);
struct Tank {
  double v_;
  double a_;
  pair<double, double> loc_;
  pair<double, double> target_;
  Tank(pair<double, double> loc, double v, double a) {
    v_ = v;
    a_ = a;
    loc_ = loc;
    double tx = cos(a);
    double ty = sin(a);
    target_ = make_pair(tx, ty);
  }
};
double angle(Tank* tank, pair<double, double> target) {
  pair<double, double> tvec = PointToVector(tank->loc_, target);
  return min(VectorAngle(tvec, tank->target_),
             VectorAngle(tank->target_, tvec));
}
double mintime(Tank* tank, pair<double, double> target) {
  return angle(tank, target) / tank->v_;
}
double speedAt(Tank* tank, pair<double, double> base, pair<double, double> p,
               double distance) {
  double a = VectorAngle(base, PointToVector(tank->loc_, p));
  return distance * tank->v_ * 1.0 / (cos(a) * cos(a));
}
int main() {
  pair<double, double> dari, tujuan;
  double d1, d2, t1, t2;
  cin >> d1 >> d2 >> t1 >> t2;
  dari = (make_pair(d1, d2));
  tujuan = make_pair(t1, t2);
  double pnj = SegmentLength(make_pair(dari, tujuan));
  vector<double> speed;
  vector<double> angle;
  vector<Tank*> tanks;
  vector<int> zerospeed;
  int n;
  cin >> n;
  for (int(i) = 0; (i) < (n); ++(i)) {
    double x, y, a, w;
    scanf("%lf%lf%lf%lf", &x, &y, &a, &w);
    speed.push_back(w);
    angle.push_back(a);
    tanks.push_back(new Tank(make_pair(x, y), w, a));
    zerospeed.push_back(abs(w) <= 1e-8);
  }
  double ubound = -2.0;
  for (int(i) = 0; (i) < (n); ++(i)) {
    if (zerospeed[i]) continue;
    double waktu = mintime(tanks[i], tujuan);
    double kecepatan = pnj / waktu;
    ubound = max((ubound), (kecepatan));
  }
  if (ubound < -1.0) {
    cout << "0.000" << endl;
    return 0;
  }
  double lbound = 0.0;
  pair<pair<double, double>, pair<double, double> > path =
      make_pair(dari, tujuan);
  for (int(i) = 0; (i) < (80); ++(i)) {
    double mid = (ubound + lbound) / 2.0;
    int failed = 0;
    for (int(j) = 0; (j) < (n); ++(j)) {
      if (zerospeed[i]) continue;
      pair<double, double>* retpoint = new pair<double, double>();
      double dist = DistanceToLine(path, tanks[j]->loc_, retpoint);
      if (!SegmentContainsPoint(path, *retpoint)) continue;
      pair<double, double> firstvec = PointToVector(tanks[j]->loc_, *retpoint);
      pair<double, double> tryvec = PointToVector(tanks[j]->loc_, tujuan);
      if (speedAt(tanks[j], firstvec, tujuan, dist) >= mid) continue;
      double lo = 0.0;
      double hi = 1.0;
      pair<double, double> bestp;
      for (int(k) = 0; (k) < (80); ++(k)) {
        double milo = (lo + hi) / 2.0;
        double px = retpoint->first + milo * (tujuan.first - retpoint->first);
        double py =
            retpoint->second + milo * (tujuan.second - retpoint->second);
        pair<double, double> tp = make_pair(px, py);
        if (speedAt(tanks[j], firstvec, tp, dist) >= mid) {
          lo = milo;
          bestp = tp;
          continue;
        }
        hi = milo;
      }
      if (SegmentLength(make_pair(bestp, dari)) / mintime(tanks[j], bestp) >
          mid) {
        failed = 1;
        break;
      }
    }
    if (!failed) {
      lbound = mid;
    } else {
      ubound = mid;
    }
  }
  printf("%.9lf\n", (ubound + lbound) / 2.0);
  return 0;
}
