#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  double sol[n];
  double a, b, v;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> v;
    sol[i] = sqrt(pow((x - a), 2) + pow((y - b), 2)) / v;
  }
  sort(sol, sol + n);
  cout << fixed << setprecision(20) << sol[0] << endl;
  return 0;
}
