#include <bits/stdc++.h>
int main(void) {
  int a, b, n, i, x, y, v, j;
  scanf("%d %d", &a, &b);
  scanf("%d", &n);
  double time[n], min;
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &x, &y, &v);
    time[i] = (double)sqrt(pow(a - x, 2) + pow(b - y, 2)) / v;
  }
  min = time[0];
  for (j = 1; j < n; j++) {
    if (min > time[j]) min = time[j];
  }
  printf("%0.20lf\n", min);
  return 0;
}
