#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  long double ans = 1e+9;
  for (int i = 0; i < n; ++i) {
    int x, y, v;
    cin >> x >> y >> v;
    long double dis = sqrt(pow((a - x), 2) + pow((b - y), 2));
    long double time = dis / v;
    ans = min(ans, time);
  }
  cout.precision(17);
  cout << ans;
  return 0;
}
