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 10<sup class="upper-index">12</sup>. It should be held for hacks as well.
First line contains four integers *x*1, *y*1, *x*2, *y*2 ( - 10<sup class="upper-index">5</sup> ≤ *x*1, *y*1, *x*2, *y*2 ≤ 10<sup class="upper-index">5</sup>) — coordinates of points that brother drew. First point has coordinates (*x*1, *y*1) and second point has coordinates (*x*2, *y*2). These two points are different.

The second line contains single integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — the number of circles that brother drew.

Next *n* lines contains descriptions of circles. Each line contains three integers *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub> ( - 10<sup class="upper-index">5</sup> ≤ *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *r*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>) describing circle with center (*x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub>) and radius *r*<sub class="lower-index">*i*</sub>.
<img class="tex-graphics" src="https://espresso.codeforces.com/5a8f62f2439db62d006a0959f077351937f109a0.png" style="max-width: 100.0%;max-height: 100.0%;"/> <img class="tex-graphics" src="https://espresso.codeforces.com/0500120c641e4aab8bb5490323ce5a68957a6621.png" style="max-width: 100.0%;max-height: 100.0%;"/>
#!/bin/python3
# template

import sys

import math


def read_ints(inp = sys.stdin):
    return list(map(int,next(inp).strip().split()))

def print_list(l):
    print(' '.join(map(str,l)))

def dist2(x1,y1,x2,y2):
    return (x2-x1)**2 + (y2-y1)**2

def inside(d2, r, r2):
    # Is first circle inside second one?
    # Yes if d <= r2-r
    if r2-r < 0:
        return False
    return d2 <= (r2-r)**2

def intersect(d2, r, r2):
    # Return true if C intersect C2 in two points
    # Assuming C not inside C2
    if d2 >= (r+r2)**2:
        return False
    if d2 <= (r-r2)**2:
        return False
    return True


def sol1(x1,y1,x2,y2, A):

    cx = (x1+x2)/2
    cy = (y1+y2)/2
    res = math.sqrt(dist2(cx,cy,x1,y1))  # r**2

    cand = A
    newres= True
    while cand and newres:
        newres = False
        cand2 = []
        for x,y,r in cand:
            d2 = dist2(x,y,cx,cy)
            if inside(d2, r, res):
                continue # discard this one
            if intersect(d2, r, res):
                res = math.sqrt(d2) + r
                newres = True
                continue
            cand2.append((x,y,r))
        cand = cand2

    return res


if __name__=='__main__':
    #T ,= read_ints()
    for i in range(1):
        points = read_ints()
        n, = read_ints()
        A = []
        for _ in range(n):
            A.append(read_ints())
        d = sol1(*points, A)
        print(d)

