#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  double a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  double ans = 1e30;
  while (n--) {
    double x, y, v;
    cin >> x >> y >> v;
    double d = sqrt(pow(x - a, 2) + pow(y - b, 2));
    if (d / v < ans) ans = d / v;
  }
  cout << fixed << setprecision(8) << ans;
  return 0;
}
