#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, q;
  cin >> a >> b >> q;
  int x, y, spd;
  double hsl = 1e7;
  double tmp;
  for (int i = 0; i < q; i++) {
    cin >> x >> y >> spd;
    int jrkX = abs(x - a);
    int jrkY = abs(y - b);
    if (jrkX == 0 || jrkY == 0) {
      tmp = (jrkX + jrkY) * 1.0 / spd;
    } else {
      double pyta = sqrt(jrkX * jrkX + jrkY * jrkY);
      tmp = (pyta * 1.0) / spd;
    }
    hsl = min(tmp, hsl);
  }
  printf("%.20f\n", hsl);
  return 0;
}
