#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  double x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  double minTime = INT_MAX;
  for (int i = 0; i < n; i++) {
    double x1, y1, v;
    cin >> x1 >> y1 >> v;
    if (minTime > sqrt(pow(x - x1, 2) + pow(y - y1, 2)) / v)
      minTime = sqrt(pow(x - x1, 2) + pow(y - y1, 2)) / v;
  }
  cout.setf(ios::fixed, ios::floatfield);
  cout << setprecision(7) << minTime << endl;
  return 0;
}
