#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t i, j, k, l;
  double m, n, p, q, r, s, a, b, c = 99999999999, x, y, z, d, t;
  cin >> a >> b;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> z;
    d = sqrt((abs(a - x) * abs(a - x)) + (abs(b - y) * abs(b - y)));
    t = d / z;
    if (c > t) c = t;
  }
  printf("%lf", c);
}
