#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
inline void take(int &x) { scanf("%d", &x); }
inline void take(int &x, int &y) { scanf("%d %d", &x, &y); }
template <class T>
inline T Set(T N, T pos) {
  return N = N | (1 << pos);
}
template <class T>
inline bool Check(T N, T pos) {
  return (bool)(N & (1 << pos));
}
template <class T>
inline T Reset(T N, T pos) {
  return N = N & ~(1 << pos);
}
template <class T>
inline T gcd(T a, T b) {
  while (a > 0 && b > 0) a > b ? a %= b : b %= a;
  return a + b;
}
template <class T>
inline T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <class T>
T big(T b, T p, T mod) {
  if (p == 0) return 1;
  if (!(p & 1)) {
    T x = big(b, p / 2, mod);
    return (x * x) % mod;
  } else
    return (b * big(b, p - 1, mod)) % mod;
}
template <class T>
T POW(T b, T p) {
  if (p == 0) return 1;
  if (!(p & 1)) {
    T x = POW(b, p / 2);
    return (x * x);
  } else
    return (b * POW(b, p - 1));
}
int fx[] = {0, 1, 0, -1, 1, -1, 1, -1};
int fy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int main() {
  double x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  double mmin = 1e7;
  for (int i = 0; i < n; i++) {
    double a, b, v;
    cin >> a >> b >> v;
    mmin = min(mmin, sqrt((x - a) * (x - a) + (y - b) * (y - b)) / v);
  }
  printf("%.7lf\n", mmin);
}
