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