#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  scanf("%d%d", &x, &y);
  int n;
  double ans = 1e18;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int q, w, v;
    scanf("%d%d%d", &q, &w, &v);
    ans = min(ans, sqrt(1. * (q - x) * (q - x) + (w - y) * (w - y)) / v);
  }
  printf("%.20f\n", ans);
}
