#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
double x, y;
pair<double, double> a[N];
int main() {
  int n;
  cin >> x >> y;
  cin >> n;
  double res = 1e9;
  for (int i = 1; i <= n; i++) {
    double v;
    cin >> a[i].first >> a[i].second >> v;
    double dist = sqrt((a[i].first - x) * (a[i].first - x) +
                       (a[i].second - y) * (a[i].second - y));
    double tmp = dist / v;
    res = min(res, tmp);
  }
  printf("%.20lf\n", res);
  return 0;
}
