#include <bits/stdc++.h>
using namespace std;
int a, b, n;
double Time = 1e9;
bool dC(double a, double b) { return a > b; }
double calcTime(double x, double y, double v) {
  return (sqrt(pow(x - a, 2) + pow(y - b, 2))) / v;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cin >> a >> b >> n;
  for (int i = 0; i < n; ++i) {
    int x, y, v;
    cin >> x >> y >> v;
    if (a == x && b == y) {
      cout << 0;
      return 0;
    }
    if (dC(Time, calcTime(x, y, v))) {
      Time = calcTime(x, y, v);
    }
  }
  cout << Time;
}
