On the xy-plane, Snuke is going to travel from the point (x_s, y_s) to the point (x_t, y_t).
He can move in arbitrary directions with speed 1.
Here, we will consider him as a point without size.
There are N circular barriers deployed on the plane.
The center and the radius of the i-th barrier are (x_i, y_i) and r_i, respectively.
The barriers may overlap or contain each other.
A point on the plane is exposed to cosmic rays if the point is not within any of the barriers.
Snuke wants to avoid exposure to cosmic rays as much as possible during the travel.
Find the minimum possible duration of time he is exposed to cosmic rays during the travel.

-----Constraints-----
 - All input values are integers.
 - -10^9 ≤ x_s, y_s, x_t, y_t ≤ 10^9
 - (x_s, y_s) ≠ (x_t, y_t)
 - 1≤N≤1,000
 - -10^9 ≤ x_i, y_i ≤ 10^9
 - 1 ≤ r_i ≤ 10^9

-----Input-----
The input is given from Standard Input in the following format:
x_s y_s x_t y_t
N
x_1 y_1 r_1
x_2 y_2 r_2
:
x_N y_N r_N

-----Output-----
Print the minimum possible duration of time Snuke is exposed to cosmic rays during the travel.
The output is considered correct if the absolute or relative error is at most 10^{-9}.

-----Sample Input-----
-2 -2 2 2
1
0 0 1

-----Sample Output-----
3.6568542495

An optimal route is as follows:

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from struct import pack, unpack\nimport math\nfrom heapq import heapify, heappush as hpush, heappop as hpop\nclass FibonacciHeap():\n    def __init__(self, mm):\n        self.inf = 1 << 100\n        self.mm = mm\n        self.roots = [[] for _ in range(mm)]\n        self.min = self.inf\n        self.minroot = None\n    \n    def add(self, v):\n        nd = self.node(v)\n        self.add_node(nd)\n        return nd\n    \n    def add_node(self, nd):\n        k = nd.order\n        if nd.value < self.min:\n            self.min = nd.value\n            self.minroot = nd\n        self.roots[k].append(nd)\n    \n    def setmin(self):\n        mi = self.inf\n        mirt = None\n        for i, rt in enumerate(self.roots):\n            while len(rt) >= 2:\n                nd1 = rt.pop()\n                nd2 = rt.pop()\n                self.roots[i+1].append(nd1.meld(nd2))\n            if len(rt) and rt[0].value < mi:\n                mi = rt[0].value\n                mirt = rt[0]\n        self.min = mi\n        self.minroot = mirt\n        return self.minroot\n    \n    def pop(self):\n        nd = self.minroot\n        mi = nd.value\n        self.roots[nd.order].remove(nd)\n        ch = nd.repChild\n        if ch:\n            nd = ch.right\n            while 1:\n                nnd = nd.right\n                self.add_node(nd)\n                l = nd.left\n                r = nd.right\n                if r != nd:\n                    nd.right = nd\n                    nd.left = nd\n                    l.right = r\n                    r.left = l\n                nd.parent = None\n                if nd == ch:\n                    break\n                nd = nnd\n        self.setmin()\n        return mi\n    class node():\n        def __init__(self, value):\n            self.parent = None\n            self.left = self\n            self.right = self\n            self.repChild = None\n            self.order = 0\n            self.marked = 0\n            self.value = value\n        \n        def meld(self, other):\n            if self.value > other.value:\n                return other.meld(self)\n            other.parent = self\n            if not self.repChild:\n                self.repChild = other\n            else:\n                l = self.repChild\n                r = l.right\n                l.right = other\n                r.left = other\n                other.left = l\n                other.right = r\n            self.order += 1\n            return self\n    \n    def movetop(self, nd):\n        p = nd.parent\n        nd.marked = 0\n        if not p: return nd\n        l = nd.left\n        r = nd.right\n        if r != nd:\n            p.repChild = r\n            nd.right = nd\n            nd.left = nd\n            l.right = r\n            r.left = l\n        else:\n            p.repChild = None\n        nd.parent = None\n        self.add_node(nd)\n        if not p.parent:\n            self.roots[p.order].remove(p)\n            p.order -= 1\n            self.add_node(p)\n        \n    def prioritize(self, nd, v):\n        p = nd.parent\n        nd.value = v\n        if v < self.min:\n            self.min = v\n            self.minroot = nd\n        if not p or p.value <= v:\n            return nd\n        self.movetop(nd)\n        nn = p\n        while nn.parent:\n            if nn.marked == 0:\n                nn.marked = 1\n                break\n            else:\n                p = nn.parent\n                self.movetop(nn)\n                nn = p\n        return nd\n            \n    def debug(self):\n        def _debug(nd):\n            if not nd: return ""\n            s = str(nd.value) + ("(" + str(nd.left.value) + "-" + str(nd.right.value) + ")" if nd != nd.right else "")\n            if nd.repChild: s += "[C=" + str(nd.repChild.value) + "]"\n            if nd.parent: s += "[P=" + str(nd.parent.value) + "]"\n            if not nd.repChild: return s\n            ss = []\n            ch = nd.repChild\n            idch = id(ch)\n            nd = ch.right\n            while 1:\n                ss.append(_debug(nd))\n                if id(nd) == idch: break\n                nd = nd.right\n            s += "[" + ", ".join(map(str, ss)) + "]"\n            return s\n        RE = []\n        for i, root in enumerate(self.roots):\n            for nd in root:\n                if nd: RE.append("<" + str(i) + ">" + _debug(nd))\n        s = "min=" + str(self.min) + " "\n        print((s + " - ".join(map(str, RE))))\n        \nxs, ys, xt, yt = list(map(int, input().split()))\nN = int(input())\nX = [(xs, ys, 0), (xt, yt, 0)]\nfor _ in range(N):\n    x, y, r = list(map(int, input().split()))\n    X.append((x, y, r))\n\nN += 2\nDD = [[0] * N for _ in range(N)]\nfor i in range(N):\n    xi, yi, ri = X[i]\n    for j in range(N):\n        xj, yj, rj = X[j]\n        DD[i][j] = max(math.sqrt((xi-xj)**2 + (yi-yj)**2) - (ri+rj), 0)\n\nm = 1023\ndef dijkstra(n, E, i0=0):\n    fb = FibonacciHeap(100)\n    inf = unpack("q", pack("d", 10 ** 10 / 1))[0]\n    D = [10 ** 10 / 1] * n\n    done = [0] * n\n    D[i0] = 0\n    V = []\n    for i in range(n):\n        v = (unpack("q", pack("d", (0.0 if i == i0 else 10 ** 10 / 1)))[0] | m) - (m - i)\n        V.append(fb.add(v))\n    while fb.minroot:\n        di = fb.pop()\n        d, i = unpack("d", pack("q", (di | m) - m))[0], di & m\n        done[i] = 1\n        for j, w in enumerate(DD[i]):\n            if done[j] or j == i: continue\n            nd = d + w\n            if D[j] > nd:\n                v = (unpack("q", pack("d", nd))[0] | m) - (m - j)\n                fb.prioritize(V[j], v)\n                D[j] = nd\n    return D\n\nprint((dijkstra(N, X)[1]))\n\n\n\n\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 25841