#include <bits/stdc++.h>
using namespace std;
int main() {
  int x0, y0;
  while (cin >> x0 >> y0) {
    int m;
    long double n[1000];
    cin >> m;
    for (int i = 0; i < m; i++) {
      long double x, y, v, t;
      cin >> x >> y >> v;
      t = sqrt(pow((x - x0), 2) + pow((y - y0), 2)) / v;
      n[i] = t;
    }
    long double time = n[0];
    for (int i = 1; i < m; i++) {
      if (n[i] < time) time = n[i];
    }
    printf("%.20lf\n", time);
  }
  return 0;
}
