#include <bits/stdc++.h>
using namespace std;
int main() {
  double x, y, x1, y1, n, ans = 0, mn = 1000000000, s;
  cin >> x >> y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> s;
    ans = (sqrt(pow((x1 - x), 2) + pow((y1 - y), 2))) / s;
    mn = min(mn, ans);
  }
  cout << fixed << setprecision(20) << mn << endl;
}
