#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int a, b, n;
  cin >> a >> b >> n;
  int taxiSpeed[n];
  double time[n];
  pair<int, int> taxi[n];
  for (int i = 0; i < n; i++)
    cin >> taxi[i].first >> taxi[i].second >> taxiSpeed[i];
  for (int i = 0; i < n; i++)
    time[i] = sqrt((a - taxi[i].first) * (a - taxi[i].first) +
                   (b - taxi[i].second) * (b - taxi[i].second)) /
              taxiSpeed[i];
  double mini = time[0];
  for (int i = 1; i < n; i++)
    if (mini > time[i]) mini = time[i];
  cout.precision(20);
  cout << mini;
}
