#include <bits/stdc++.h>
using namespace std;
int main() {
  float a, b, answer = 1000000;
  cin >> a >> b;
  short int taxi;
  cin >> taxi;
  while (taxi--) {
    float x, y, speed, time;
    cin >> x >> y >> speed;
    float total;
    total = sqrt(pow((x - a), 2) + pow((y - b), 2)) / speed;
    if (total <= answer) {
      answer = total;
    }
  }
  cout << fixed << setprecision(16) << answer << endl;
}
