#include <bits/stdc++.h>
using namespace std;
double dis(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  double x1, y1, x2, y2, v, t;
  int n;
  while (cin >> x1 >> y1) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> x2 >> y2 >> v;
      if (i == 0)
        t = dis(x1, y1, x2, y2) / v;
      else
        t = min(t, dis(x1, y1, x2, y2) / v);
    }
    cout << fixed << setprecision(9) << t << '\n';
  }
  return 0;
}
