#include <bits/stdc++.h>
using namespace std;
void ga(int N, int *A) {
  for (int i(0); i < N; i++) scanf("%d", A + i);
}
char s[(1 << 19)], r[(1 << 19)];
long long S;
int N, M, A, B, a, b, c;
long double d, u, v, w, X;
int main(void) {
  scanf("%d%d%d", &A, &B, &N), X = 1e18;
  for (int i(0); i < N; i++)
    cin >> u >> v >> w,
        X = min(X, sqrt(pow((A) - (u), 2) + pow((B) - (v), 2)) / w);
  cout << fixed << setprecision(30) << X << endl;
  return 0;
}
