#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  bool flag = false;
  double mn = 1000000;
  double A, B, C, D, E;
  cin >> A >> B >> N;
  for (int i = 0; i < N; i++) {
    cin >> C >> D >> E;
    if (!flag || mn > (((A - C) * (A - C) + (B - D) * (B - D)) / (E * E))) {
      flag = true;
      mn = ((A - C) * (A - C) + (B - D) * (B - D)) / (E * E);
    }
  }
  printf("%.7lf\n", sqrt(mn));
  return 0;
}
