#include <bits/stdc++.h>
using namespace std;
double ti = INT_MAX;
int main() {
  int x1, y1, n;
  cin >> x1 >> y1 >> n;
  for (int i = 1; i <= n; i++) {
    int x, y, v;
    cin >> x >> y >> v;
    double d = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
    d = (double)d / (double)v;
    ti = min(d, ti);
  }
  cout << fixed << setprecision(10) << ti;
  return 0;
}
