#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int t;
  double min = INT_MAX;
  cin >> t;
  for (int i = 0; i < t; i++) {
    double x, y, v;
    cin >> x >> y >> v;
    double ti = sqrt(pow(abs(x - a), 2) + pow(abs(y - b), 2)) / v;
    if (min > ti) min = ti;
  }
  cout << fixed << setprecision(8) << min << "\n";
  return 0;
}
