#include <bits/stdc++.h>
using namespace std;
const int M5 = 1e5 + 3;
const int M9 = 1e9 + 3;
double x, y;
double t, a, b, v;
double ans = 0;
void GIAI() {
  cin >> x >> y >> t;
  t -= 1;
  cin >> a >> b >> v;
  a = sqrt((x - a) * (x - a) + (y - b) * (y - b));
  ans = a / v;
  while (t--) {
    cin >> a >> b >> v;
    a = sqrt((x - a) * (x - a) + (y - b) * (y - b));
    ans = (double)min(ans, a / v);
  }
  printf("%.20lf", ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  GIAI();
  return 0;
}
