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