#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
bool des(int i, int j) { return i > j; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, i, a, b, x, y, v;
  double ans = INF, t, d;
  bool flg = 0;
  cin >> a >> b >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y >> v;
    d = sqrt((x - a) * (x - a) + (y - b) * (y - b));
    t = d / v;
    ans = min(ans, t);
  }
  cout.precision(12);
  cout << fixed << ans << endl;
}
