#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, n;
  double a, b, minimum = 1777777777, temp;
  cin >> a >> b >> n;
  double x[n], y[n], v[n];
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> v[i];
  }
  for (i = 0; i < n; i++) {
    temp = (x[i] - a) * (x[i] - a) + (y[i] - b) * (y[i] - b);
    temp = sqrt(temp) / v[i];
    if (temp <= minimum) {
      minimum = temp;
    }
  }
  printf("%8.22f\n", minimum);
  return 0;
}
