#include <bits/stdc++.h>
using namespace std;
int a, b, n;
long double timeCalc(int x, int y, int v) {
  long double dist = pow((a - x) * (a - x) + (b - y) * (b - y), 0.5);
  return dist / v;
}
int main() {
  int x, y, v;
  long double t;
  long double Min = 999999999.9;
  scanf("%d %d", &a, &b);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &x, &y, &v);
    t = timeCalc(x, y, v);
    if (t < Min) Min = t;
  }
  printf("%.20Lf\n", Min);
  return 0;
}
