#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  double a, b, x, y, v, d;
  cin >> a >> b;
  int i;
  double n, ans = 1e10;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x >> y >> v;
    d = sqrt(fabs(x - a) * fabs(x - a) + fabs(y - b) * fabs(y - b));
    ans = min(ans, (d / v));
  }
  cout << setprecision(10) << fixed << ans << endl;
  return 0;
}
