Problem: Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. 

Masha has just returned from geometry lesson so she instantly noticed some interesting facts about brother's drawing.

At first, the line going through two points, that brother drew, doesn't intersect or touch any circle.

Also, no two circles intersect or touch, and there is no pair of circles such that one circle is located inside another.

Moreover, for each circle, Masha drew a square of the minimal area with sides parallel axis such that this circle is located inside the square and noticed that there is no two squares intersect or touch and there is no pair of squares such that one square is located inside other.

Now Masha wants to draw circle of minimal possible radius such that it goes through two points that brother drew and doesn't intersect any other circle, but other circles can touch Masha's circle and can be located inside it.

It's guaranteed, that answer won't exceed 1012. It should be held for hacks as well.

Input

First line contains four integers x1, y1, x2, y2 ( - 105 ≤ x1, y1, x2, y2 ≤ 105) — coordinates of points that brother drew. First point has coordinates (x1, y1) and second point has coordinates (x2, y2). These two points are different.

The second line contains single integer n (1 ≤ n ≤ 105) — the number of circles that brother drew.

Next n lines contains descriptions of circles. Each line contains three integers xi, yi, ri ( - 105 ≤ xi, yi ≤ 105, 1 ≤ ri ≤ 105) describing circle with center (xi, yi) and radius ri.

Output

Output smallest real number, that it's possible to draw a circle with such radius through given points in such a way that it doesn't intersect other circles.

The output is considered correct if it has a relative or absolute error of at most 10 - 4.

Examples

Input

2 4 7 13
3
3 0 1
12 4 2
-4 14 2


Output

5.1478150705

Input

-2 3 10 -10
2
7 0 3
-5 -5 2


Output

9.1481831923

Note

<image> <image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int FFTMOD = 1007681537;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
struct PT {
  long double x, y;
  PT() : x(0), y(0) {}
  PT(long double x, long double y) : x(x), y(y) {}
  PT(const PT& p) : x(p.x), y(p.y) {}
  int operator<(const PT& rhs) const {
    return make_pair(y, x) < make_pair(rhs.y, rhs.x);
  }
  int operator==(const PT& rhs) const {
    return make_pair(y, x) == make_pair(rhs.y, rhs.x);
  }
  PT operator+(const PT& p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT& p) const { return PT(x - p.x, y - p.y); }
  PT operator*(long double c) const { return PT(x * c, y * c); }
  PT operator/(long double c) const { return PT(x / c, y / c); }
};
long double cross(PT p, PT q) { return p.x * q.y - p.y * q.x; }
long double area(PT a, PT b, PT c) {
  return fabs(cross(a, b) + cross(b, c) + cross(c, a)) / 2;
}
long double area2(PT a, PT b, PT c) {
  return cross(a, b) + cross(b, c) + cross(c, a);
}
long double dot(PT p, PT q) { return p.x * q.x + p.y * q.y; }
long double dist(PT p, PT q) { return sqrt(dot(p - q, p - q)); }
long double dist2(PT p, PT q) { return dot(p - q, p - q); }
PT RotateCCW90(PT p) { return PT(-p.y, p.x); }
PT RotateCW90(PT p) { return PT(p.y, -p.x); }
PT RotateCCW(PT p, long double t) {
  return PT(p.x * cos(t) - p.y * sin(t), p.x * sin(t) + p.y * cos(t));
}
ostream& operator<<(ostream& os, const PT& p) {
  os << "(" << p.x << "," << p.y << ")";
  return os;
}
pair<long double, long double> solve(long double a, long double b,
                                     long double c) {
  long double delta = b * b - 4 * a * c;
  if (delta < 0) delta = 0;
  long double x1 = (-b - sqrt(delta)) / 2 / a;
  long double x2 = (-b + sqrt(delta)) / 2 / a;
  return make_pair(x1, x2);
}
inline long double sqr(long double x) { return x * x; }
const int maxn = 1e5 + 5;
int n;
PT a, b;
PT cen[maxn];
long double rad[maxn];
long double ff(int u) {
  long double lo = -1e12, hi = 1e12;
  int sign = 1;
  if (cen[u].x > 0) cen[u].x *= -1, sign = -1;
  for (int it = (0); it < (100); it++) {
    long double mi = (lo + hi) / 2;
    PT p = PT(mi, 0);
    int sign = 1;
    if (dist(p, cen[u]) <= dist(p, b) + rad[u]) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  cen[u].x *= sign;
  return sign * (lo + hi) / 2;
}
long double gg(int u) {
  long double lo = -1e12, hi = 1e12;
  int sign = 1;
  if (cen[u].x > 0) cen[u].x *= -1, sign = -1;
  for (int it = (0); it < (100); it++) {
    long double mi = (lo + hi) / 2;
    PT p = PT(mi, 0);
    int sign = 1;
    if (dist(p, cen[u]) <= dist(p, b) - rad[u]) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  cen[u].x *= sign;
  return sign * (lo + hi) / 2;
}
void solve() {
  cin >> a.x >> a.y >> b.x >> b.y;
  b = b - a;
  cin >> n;
  for (int i = (0); i < (n); i++)
    cin >> cen[i].x >> cen[i].y >> rad[i], cen[i] = cen[i] - a;
  long double al = atan2(b.y, b.x);
  b = RotateCCW(b, PI / 2 - al);
  for (int i = (0); i < (n); i++) {
    cen[i] = RotateCCW(cen[i], PI / 2 - al);
    cen[i].y -= b.y / 2;
  }
  b.y /= 2;
  vector<pair<long double, int> > events;
  events.push_back(make_pair(0, 2));
  for (int i = (0); i < (n); i++) {
    double l = gg(i);
    double r = ff(i);
    if (l > r) swap(l, r);
    events.push_back(make_pair(l, 0));
    events.push_back(make_pair(r, 1));
  }
  sort((events).begin(), (events).end());
  int ptr = 0, cnt = 0;
  long double ans = 1e100;
  for (int i = (0); i < (int((events).size())); i++) {
    int add = 0;
    while (ptr < int((events).size()) &&
           !sign(events[ptr].first, events[i].first)) {
      if (!events[ptr].second) {
        add++;
      } else if (events[ptr].second == 1) {
        cnt--;
      }
      ptr++;
    }
    if (!cnt) {
      chkmin(ans, dist(PT(events[i].first, 0), b));
    }
    cnt += add;
  }
  cout << fixed << setprecision(9) << ans << "\n";
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int JUDGE_ONLINE = 1;
  if (argc > 1) {
    JUDGE_ONLINE = 0;
    assert(freopen(argv[1], "r", stdin));
  }
  if (argc > 2) {
    JUDGE_ONLINE = 0;
    assert(freopen(argv[2], "wb", stdout));
  }
  solve();
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}