#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
};
inline double cal(Point A, Point B) {
  return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}
int main() {
  Point s;
  scanf("%lf%lf", &s.x, &s.y);
  int N;
  scanf("%d", &N);
  double ans = 0X7FFFFFFF * 1.0;
  while (N--) {
    Point a;
    double v;
    scanf("%lf%lf%lf", &a.x, &a.y, &v);
    double l = cal(a, s);
    l /= v;
    if (l < ans) ans = l;
  }
  printf("%.10lf\n", ans);
  return 0;
}
