#include <bits/stdc++.h>
using namespace std;
double dis(int x, int y, int a, int b) {
  int dx = x - a;
  int dy = y - b;
  return sqrt(dx * dx + dy * dy);
}
int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  int n;
  scanf("%d", &n);
  double ans = 100000;
  for (int i = 0; i < n; i++) {
    int a, b, v;
    scanf("%d %d %d", &a, &b, &v);
    ans = min(ans, dis(x, y, a, b) / v);
  }
  printf("%.6lf", ans);
}
