#include <bits/stdc++.h>
using namespace std;
int main() {
  double x;
  cin >> x;
  double y;
  cin >> y;
  double n;
  cin >> n;
  double xi, yi, vi;
  double minn = 9999999;
  while (n--) {
    cin >> xi;
    cin >> yi;
    cin >> vi;
    double sal = sqrt(pow(x - xi, 2) + pow(y - yi, 2)) / vi;
    minn = min(sal, minn);
  }
  cout << fixed << setprecision(20) << minn << endl;
}
