#include <bits/stdc++.h>
using namespace std;
int T;
int main() {
  double ans = 100000000, a, b, x, y, v;
  int n, i;
  cin >> a >> b;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y >> v;
    ans = min(ans, sqrt((a - x) * (a - x) + (b - y) * (b - y)) / v);
  }
  printf("%.8lf", ans);
}
