#include <bits/stdc++.h>
using namespace std;
int a, b;
int n;
struct taxi {
  int a;
  int b;
  int v;
  taxi(int _a = 0, int _b = 0, int _c = 0) {
    a = _a;
    b = _b;
    v = _c;
  }
};
taxi t[1001];
double m = 1000000, p, q;
int main(int argc, const char* argv[]) {
  cin >> a >> b >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t[i].a >> t[i].b >> t[i].v;
    p = a - t[i].a;
    q = b - t[i].b;
    m = min(m, sqrt(p * p + q * q) / t[i].v);
  }
  cout.precision(10);
  cout << m << endl;
  return 0;
}
