#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
long long n;
int main() {
  ios_base::sync_with_stdio(0);
  long double a, b, k, ans = 1000000.0, x, y;
  cin >> a >> b;
  cin >> n;
  for (; n--;) {
    cin >> x >> y >> k;
    long double d = sqrt((a - x) * (a - x) + (b - y) * (b - y));
    ans = min(ans, d / k);
  }
  cout << fixed << setprecision(8) << ans;
}
