#include <bits/stdc++.h>
int main() {
  long long int a, b;
  scanf("%lld %lld", &a, &b);
  long long int n;
  scanf("%lld", &n);
  long long int x[n], y[n], v[n], i;
  double ans, sp, min = 1000000;
  for (i = 0; i < n; i++) {
    scanf("%lld %lld %lld", &x[i], &y[i], &v[i]);
    ans = sqrt((x[i] - a) * (x[i] - a) + (y[i] - b) * (y[i] - b));
    sp = v[i];
    if (ans / sp < min) min = ans / sp;
  }
  printf("%.20lf", min);
  return 0;
}
