#include <bits/stdc++.h>
using namespace std;
int main() {
  double x, y;
  int n;
  double a, b, v, minn = 0x3f3f3f3f, t;
  scanf("%lf%lf%d", &x, &y, &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf%lf", &a, &b, &v);
    t = sqrt((a - x) * (a - x) + (b - y) * (b - y)) / v;
    minn = min(minn, t);
  }
  printf("%.20f", minn);
  return 0;
}
