#include <bits/stdc++.h>
using std::cin;
using std::cout;
int a, b, n, x, y, v;
double t = 1000;
int sqr(int n) { return n * n; }
int main() {
  cin >> a >> b >> n;
  while (n--) {
    cin >> x >> y >> v;
    t = std::min(t, sqrt(double(sqr(a - x) + sqr(b - y))) / v);
  }
  cout << std::setprecision(12) << t;
  return 0;
}
