#include <bits/stdc++.h>
int main() {
  float a, b, x, y, v, g, k = 10000.000;
  int i, n;
  scanf("%f %f %d", &a, &b, &n);
  for (i = 0; i < n; i++) {
    scanf("%f %f %f", &x, &y, &v);
    g = (x - a) * (x - a) + (y - b) * (y - b);
    g = sqrt(g);
    g = g / v;
    if (g < k) {
      k = g;
    }
  }
  printf("%f\n", k);
  return 0;
}
