#include <bits/stdc++.h>
using namespace std;
int main() {
  double x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  double min = 1000000000;
  while (n--) {
    double x1, y1, v;
    cin >> x1 >> y1 >> v;
    double newans = sqrt(((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y)));
    newans = newans / v;
    if (newans < min) min = newans;
  }
  cout << fixed << setprecision(20) << min;
}
