#include <bits/stdc++.h>
using namespace std;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  long double a, b, x, y, v, ans = 1e9;
  int n;
  cin >> a >> b;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> v;
    ans = min(ans, dist(x, y, a, b) / v);
  }
  printf("%.8llf", ans);
  return 0;
}
