#include <bits/stdc++.h>
using namespace std;
int a, b, n, i, j, d, x, y;
double smn, vmn;
int main() {
  cin >> a >> b >> n;
  double s[n], v[n];
  for (i = 0; i < n; i++) {
    cin >> x >> y >> v[i];
    s[i] = (double)sqrt(pow(x - a, 2) + pow(y - b, 2));
  }
  smn = s[0];
  vmn = v[0];
  for (i = 1; i < n; i++) {
    if (s[i] * vmn < v[i] * smn) {
      vmn = v[i];
      smn = s[i];
    }
  }
  cout << setprecision(20) << smn / vmn;
}
