#include <bits/stdc++.h>
using namespace std;
long double ans, temp, x, y, v, a, b, N;
int main() {
  cin >> a >> b;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x >> y >> v;
    if (!i)
      ans = sqrt((x - a) * (x - a) + (y - b) * (y - b)), ans /= v;
    else {
      temp = sqrt((x - a) * (x - a) + (y - b) * (y - b));
      temp /= v;
      ans = min(ans, temp);
    }
  }
  cout << fixed << setprecision(10) << ans << '\n';
}
