#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.setf(ios_base::fixed);
  int a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  int x, y, v;
  double ans = (double)INT_MAX;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> v;
    x = a - x;
    y = b - y;
    ans = min(ans, ((double)(x * x + y * y)) / (v * v));
  }
  cout << sqrt(ans) << endl;
  return 0;
}
