#include <bits/stdc++.h>
#pragma warning(disable : 4996)
int main() {
  int a, b, n;
  scanf("%d%d%d", &a, &b, &n);
  double min_time;
  for (int i = 0; i < n; i++) {
    int x, y, v;
    double time;
    scanf("%d%d%d", &x, &y, &v);
    time =
        (double)(sqrt(pow((double)(x - a), 2) + pow((double)(y - b), 2)) / v);
    if (i == 0)
      min_time = time;
    else if (min_time > time)
      min_time = time;
  }
  printf("%lf", min_time);
  return 0;
}
