#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10, pi = acos(-1.0);
int main() {
  int n, t = 1;
  while (t--) {
    double a, b, x, y, v;
    double ans = 1000000000.00;
    cin >> a >> b;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      double d = sqrt(((x - a) * (x - a)) + ((y - b) * (y - b)));
      ans = min(ans, d / v);
    }
    printf("%0.08lf\n", ans);
  }
  return 0;
}
