#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  double ans = INT_MAX;
  for (int i = 0; i < n; i++) {
    int x, y, v;
    cin >> x >> y >> v;
    double dist;
    dist = abs(x - a);
    dist = dist * dist;
    dist += (abs(y - b) * abs(y - b));
    dist = sqrt(dist);
    double tm = dist / v;
    if (tm < ans) ans = tm;
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
