#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
inline int Set(int N, int pos) { return N = N | (1 << pos); }
inline int Reset(int N, int pos) { return N = N & ~(1 << pos); }
inline bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
struct node {
  double x, y, v;
};
node arr[100000];
int main() {
  double a, b;
  int n;
  cin >> a >> b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].x >> arr[i].y >> arr[i].v;
  }
  double mn = 10000000;
  for (int i = 0; i < n; i++) {
    double dis =
        sqrt((a - arr[i].x) * (a - arr[i].x) + (b - arr[i].y) * (b - arr[i].y));
    double t = dis / (arr[i].v * 1.0);
    mn = min(mn, t);
  }
  printf("%0.10f\n", mn);
  return 0;
}
