#include <bits/stdc++.h>
using namespace std;
int a, b, n;
double f(double x, double y, double v) {
  double d = sqrt(pow(a - x, 2) + pow(b - y, 2));
  return d / v;
}
int main() {
  double x2 = 1e10;
  cin >> a >> b >> n;
  double **arry = new double *[n];
  for (int i = 0; i < n; i++) {
    arry[i] = new double[3];
    cin >> arry[i][0] >> arry[i][1] >> arry[i][2];
    x2 = min(f(arry[i][0], arry[i][1], arry[i][2]), x2);
  }
  cout << fixed << setprecision(20) << x2 << endl;
  return 0;
}
