#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<double> x;
  int a, b, v = 0;
  double e;
  cin >> a >> b;
  int c;
  cin >> c;
  for (int i = 0; i < c; i++) {
    double t, s, z;
    cin >> t >> s >> z;
    e = sqrt((abs(a - t) * abs(a - t) + abs(s - b) * abs(s - b)) / (z * z));
    x.push_back(e);
  }
  sort(x.begin(), x.end());
  cout.precision(20);
  cout << fixed << x[0];
}
