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