#include <bits/stdc++.h>
using namespace std;
long double length(long long x, long long y) { return sqrt(x * x + y * y); }
int main() {
  long long a, b, n, x, y, v;
  long double d = 9e100;
  cin >> a >> b >> n;
  cout.setf(ios::fixed);
  cout.precision(30);
  for (auto i = 0; i < n; i++) {
    cin >> x >> y >> v;
    d = min(d, length(a - x, b - y) / v);
  }
  cout << d;
  return 0;
}
