#include <bits/stdc++.h>
using namespace std;
float dist(int x1, int y1, int x2, int y2, int v) {
  return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) / v;
}
int main(int argc, char const *argv[]) {
  int x, y, i, a, b, v;
  float min = -1;
  scanf("%d %d %d", &x, &y, &i);
  for (int j = 0; j < i; ++j) {
    scanf("%d %d %d", &a, &b, &v);
    float distance = dist(x, y, a, b, v);
    min = min == -1 ? distance : min < distance ? min : distance;
  }
  printf("%f\n", min);
  return 0;
}
