#include <bits/stdc++.h>
const int INF = 0xfffffff;
const int maxn = 100010;
const double EPS = 1e-9;
using namespace std;
double sx, sy;
int main(void) {
  while (cin >> sx >> sy) {
    int n;
    cin >> n;
    double a, b, v;
    double minn = 1e9, tmp;
    for (int i = 0; i < n; ++i) {
      cin >> a >> b >> v;
      double tx = sx - a;
      double ty = sy - b;
      tmp = (double)sqrt(tx * tx + ty * ty) / v;
      minn = min(tmp, minn);
    }
    printf("%f\n", minn);
  }
  return 0;
}
