#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MOD = 1000000007;
const long long L_MAX = 9223372036854775807;
const int I_MAX = 2147483647;
double sx, sy;
double getDist(double a, double b) {
  return sqrt((sx - a) * (sx - a) + (sy - b) * (sy - b));
}
int main(int argc, const char **argv) {
  double mintime = INF * 1.0, r, p, v;
  while (cin >> sx >> sy) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> r >> p >> v;
      mintime = min(mintime, (getDist(r, p) / v));
    }
    cout << fixed << setprecision(10) << mintime << endl;
  }
  return 0;
}
