#include <bits/stdc++.h>
using namespace std;
int main() {
  double x1, y1, n, x, y, p = 90000000000, s, a;
  int i;
  scanf("%lf%lf", &x, &y);
  scanf("%lf", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lf%lf%lf", &x1, &y1, &s);
    a = sqrt(((x - x1) * (x - x1)) + (y - y1) * (y - y1));
    a = a / s;
    if (a < p) {
      p = a;
    }
  }
  printf("%.20lf\n", p);
  return 0;
}
