#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
} home, taxi;
double v;
double ans = 1e10;
int n;
double dist(const Point &a, const Point &b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  cin >> home.x >> home.y;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> taxi.x >> taxi.y >> v;
    double dis = dist(home, taxi);
    ans = min(ans, dis / v);
  }
  printf("%.10lf\n", ans);
  return 0;
}
