#include <bits/stdc++.h>
using namespace std;
int main() {
  long double x, y, x1, y1, a, mn = 1e12, n;
  cin >> x >> y >> n;
  while (n--) {
    cin >> x1 >> y1 >> a;
    mn = min(mn, sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y)) / a);
  }
  cout << fixed << setprecision(20) << mn;
  return 0;
}
