#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  double x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  double ans = 500;
  while (n--) {
    double a, b, v;
    cin >> a >> b >> v;
    ans = min(ans, sqrt((a - x) * (a - x) + (b - y) * (b - y)) / v);
  }
  std::cout << std::fixed;
  std::cout << std::setprecision(10);
  cout << ans << endl;
  return 0;
}
