#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, n;
  cin >> a >> b;
  cin >> n;
  double x, y, v;
  cin >> x >> y >> v;
  double d = pow(x - a, 2) + pow(y - b, 2);
  d = sqrt(d) / v;
  double min = d;
  for (int i = 0; i < n - 1; ++i) {
    cin >> x >> y >> v;
    double d = pow(x - a, 2) + pow(y - b, 2);
    d = sqrt(d) / v;
    if (d < min) min = d;
  }
  printf("%0.20f", min);
  return 0;
}
