#include <bits/stdc++.h>
int main() {
  double a, b, min;
  scanf("%lf %lf", &a, &b);
  int t, i;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    double x, y, s, d, v;
    scanf("%lf %lf %lf", &x, &y, &v);
    s = sqrt(((x - a) * (x - a)) + ((y - b) * (y - b)));
    d = s / v;
    if (i == 1)
      min = d;
    else {
      if (d < min) min = d;
    }
  }
  printf("%lf\n", min);
  return 0;
}
