#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y;
  P(int x = 0, int y = 0) {
    this->x = x;
    this->y = y;
  }
};
int dis(P aa, P bb) {
  return (((aa.x - bb.x) * (aa.x - bb.x)) + ((aa.y - bb.y) * (aa.y - bb.y)));
}
int main() {
  P s, w;
  int n, i, v, q;
  double an = 1000000000000.0, d;
  scanf("%d%d", &s.x, &s.y);
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d%d", &w.x, &w.y, &v);
    q = dis(s, w);
    d = sqrt(q * 1.0) / (v * 1.0);
    if (an > d + 1e-10) an = d;
  }
  printf("%.8lf\n", an);
  return 0;
}
