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