#include <bits/stdc++.h>
using namespace std;
long long i, j, k, T, t = 1, l, m, n, x, y, ans = 0, sum = 0;
double dis = INFINITY, p;
double d, a, b;
int main() {
  cin >> a >> b;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j >> k >> d;
    p = ((a - j) * (a - j) + (b - k) * (b - k) * 1.0);
    p = sqrt(p);
    p = p / d;
    dis = min(p, dis);
  }
  printf("%.20f", dis);
  return 0;
}
