#include <bits/stdc++.h>
using namespace std;
const double INF = 2000000000.0;
struct point {
  double x, y;
  point() {
    x = 0;
    y = 0;
  }
  point(double a, double b) {
    x = a;
    y = b;
  }
  double getLength() { return sqrt(x * x + y * y); }
};
double dot_product(point a, point b) { return a.x * b.x + a.y * b.y; }
double cross_product(point a, point b) { return a.x * b.y - a.y * b.x; }
istream &operator>>(istream &in, point &p) {
  in >> p.x >> p.y;
  return in;
}
bool isDiff(double a, double b) {
  return ((a <= 0 && b >= 0) || (a >= 0 && b <= 0));
}
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
bool isEqualSign(double a, double b) {
  return ((a < 0 && b < 0) || (a > 0 && b > 0));
}
double v;
int n;
point taxi, p;
int main() {
  cin >> p;
  cin >> n;
  double ans = INF;
  for (int i = 0; i < n; i++) {
    cin >> taxi >> v;
    ans = min(ans, (taxi - p).getLength() / v);
  }
  printf("%.10f", ans);
}
