#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  double x, y;
  cin >> x >> y;
  int n;
  double min_time;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    double first, second;
    cin >> first >> second;
    double distance =
        sqrt((x - first) * (x - first) + (y - second) * (y - second));
    double v;
    cin >> v;
    double time = (double)distance / (double)v;
    if (i == 0) {
      min_time = time;
      continue;
    }
    if (time < min_time) min_time = time;
  }
  cout.precision(18);
  cout << min_time << endl;
  return 0;
}
