#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n, x, y, v;
  cin >> a >> b >> n;
  int i;
  double m = 99999.0, t;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> v;
    if (x == a && y == b) {
      cout << 0.00000000000;
      return 0;
    }
    t = (double)(sqrt((x - a) * (x - a) + (y - b) * (y - b))) / v;
    if (t < m) m = t;
  }
  printf("%.12f", m);
  return 0;
}
