#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, mn = 1e12;
  cin >> a >> b;
  int n;
  cin >> n;
  while (n--) {
    double x, y, v, dis;
    cin >> x >> y >> v;
    dis = sqrt((a - x) * (a - x) + (b - y) * (b - y));
    dis /= v;
    mn = min(mn, dis);
  }
  cout << fixed << setprecision(7) << mn << endl;
  return 0;
}
