#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, x, y, s, v;
  double t, d, ans = 1000000000000.00;
  cin >> x >> y >> s;
  while (s--) {
    cin >> a >> b >> v;
    d = sqrt((a - x) * (a - x) + (b - y) * (b - y));
    t = (d / v + 0.0);
    ans = min(ans, t);
  }
  cout << setprecision(20) << fixed << ans << endl;
}
