#include <bits/stdc++.h>
using namespace std;
double get(int x, int y) { return sqrt(x * x + y * y); }
int main() {
  long long x, y;
  cin >> x >> y;
  int N;
  cin >> N;
  double res = 100000000.0000;
  for (int n = 0; n < N; ++n) {
    int x1, y1, z1;
    scanf("%d%d%d", &x1, &y1, &z1);
    res = min(res, get(x - x1, y - y1) / (double)z1);
  }
  printf("%.9lf\n", res);
  return 0;
}
