#include <bits/stdc++.h>
using namespace std;
int main() {
  double n, m, a, b, s, t = 500.0;
  int num;
  cin >> n >> m >> num;
  for (int i = 0; i < num; ++i) {
    cin >> a >> b >> s;
    if (sqrt((a - n) * (a - n) + (b - m) * (b - m)) / s < t)
      t = sqrt((a - n) * (a - n) + (b - m) * (b - m)) / s;
  }
  printf("%.20f\n", t);
  return 0;
}
