#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  vector<double> v;
  while (n--) {
    int x, y, vv;
    cin >> x >> y >> vv;
    long long d = (x - a) * (x - a) + (y - b) * (y - b);
    double dd = sqrt(d * 1.000000);
    dd /= (vv * 1.00);
    v.push_back(dd);
  }
  sort(v.begin(), v.end());
  printf("%.20lf\n", v[0]);
  return 0;
}
