#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, n, x, y, v;
  double mini = 1000;
  cin >> a >> b >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> v;
    double time = sqrt((x - a) * (x - a) + (y - b) * (y - b));
    mini = min(mini, time / v);
  }
  cout << fixed << setprecision(20) << mini;
  return 0;
}
