Polycarp lives on the coordinate axis $Ox$ and travels from the point $x=a$ to $x=b$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.

On the axis $Ox$ at the point $x=c$ the base station of the mobile operator is placed. It is known that the radius of its coverage is $r$. Thus, if Polycarp is at a distance less than or equal to $r$ from the point $x=c$, then he is in the network coverage area, otherwise — no. The base station can be located both on the route of Polycarp and outside it.

Print the time in minutes during which Polycarp will not be in the coverage area of the network, with a rectilinear uniform movement from $x=a$ to $x=b$. His speed — one unit of distance per minute.


-----Input-----

The first line contains a positive integer $t$ ($1 \le t \le 1000$) — the number of test cases. In the following lines are written $t$ test cases.

The description of each test case is one line, which contains four integers $a$, $b$, $c$ and $r$ ($-10^8 \le a,b,c \le 10^8$, $0 \le r \le 10^8$) — the coordinates of the starting and ending points of the path, the base station, and its coverage radius, respectively.

Any of the numbers $a$, $b$ and $c$ can be equal (either any pair or all three numbers). The base station can be located both on the route of Polycarp and outside it.


-----Output-----

Print $t$ numbers — answers to given test cases in the order they are written in the test. Each answer is an integer — the number of minutes during which Polycarp will be unavailable during his movement.


-----Example-----
Input
9
1 10 7 1
3 3 3 0
8 2 10 4
8 2 10 100
-10 20 -17 2
-3 2 2 0
-3 1 2 0
2 3 2 3
-1 3 -2 2

Output
7
0
4
0
30
5
4
0
3



-----Note-----

The following picture illustrates the first test case.  [Image] Polycarp goes from $1$ to $10$. The yellow area shows the coverage area of the station with a radius of coverage of $1$, which is located at the point of $7$. The green area shows a part of the path when Polycarp is out of coverage area.

Difficulty: interview

Starter code:

Solutions:
import os
from io import BytesIO

# input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
for i in range(int(input())):
    a, b, c, r = list(map(int, input().split()))
    a, b = min(a, b), max(a, b)
    left = max(c - r, a)
    right = min(c + r, b)
    if right >= a and left <= right:
        print(b - a - (right - left))
    else:
        print(b - a)


from math import *
import os, sys
from io import BytesIO

#input = BytesIO(os.read(0, os.fstat(0).st_size)).readline
sys.setrecursionlimit(10 ** 9)
#sys.stdin = open("moobuzz.in", 'r')
#sys.stdout = open("moobuzz.out", 'w')


for i in range(int(input())):
	a, b, c, r = list(map(int, input().split()))
	c1 = c - r
	c2 = c + r
	d1 = max(min(a, b), min(c1, c2))
	d2 = min(max(a, b), max(c1, c2))
	print(abs(b - a) - max(d2 - d1, 0))


t = int(input())
for i in range(t):
    a, b, c, r = list(map(int, input().split()))

    s = max(min(a, b), c - r)
    f = min(max(a, b), c + r)

    l = max(0, f - s)
    print(abs(a - b) - l)


#!/usr/bin/env python3
# coding: utf-8
# Last Modified: 24/Dec/19 08:08:49 PM


import sys


def main():
    for tc in range(int(input())):
        a, b, c, r = get_ints()

        if a > b:
            a, b = b, a

        arr = [c - r, c + r]

        ans = 0

        if a > c + r:
            print(abs(b - a))
            continue

        if b < c - r:
            print(abs(b - a))
            continue

        if a < c - r:
            ans += abs(a - (c - r))

        if b > c + r:
            ans += abs(b - (c + r))

        print(ans)


get_array = lambda: list(map(int, sys.stdin.readline().split()))


get_ints = lambda: list(map(int, sys.stdin.readline().split()))


input = lambda: sys.stdin.readline().strip()


def __starting_point():
    main()

__starting_point()

for _ in range(int(input())):
    a,b,c,r=map(int,input().split())
    a,b=min(a,b),max(a,b)
    n = b - a
    l,f = c-r,c+r
    if a>l:
        a,b,l,f=l,f,a,b
    # print (a,b,l,f)

    if l >= b:
        print (n)
    else:
        if f <= b:
            print (n - (f - l))
        else:
            print (n - (b - l))

t = int(input())
for i in range(t):
	a, b, c, r = list(map(int, input().split()))
	if b < a:
		a, b = b, a
	k = min(c + r, b) - max(c - r, a)
	d = b - a
	if k <= 0:
		print(d)
	else:
		print(d - k)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return list(map(int,minp().split()))

def solve():
	a,b,c,r = mints()
	if a > b:
		a, b = b, a
	return b-a-max(min(c+r,b)-max(c-r,a), 0)

for i in range(mint()):
	print(solve())


for tcase in range(int(input())):
    a,b,c,r = list(map(int, input().split()))

    ca, cb = c-r, c+r

    a,b = min(a,b), max(a,b)

    if b<=ca:
        print(b-a)
    elif cb<=a:
        print(b-a)
    elif a<=ca<=b<=cb:
        print(ca-a)
    elif ca<=a<=cb<=b:
        print(b-cb)
    elif a<=ca<=cb<=b:
        print((ca-a)+(b-cb))
    elif ca<=a<=b<=cb:
        print(0)
    else:
        print(0)


import sys
from collections import Counter
from math import *

# sys.stdin = open("in.txt")
for _ in range(int(input())):
    a, b, c, r = map(int, input().split())
    if b < a:
        a, b = b, a
    res1 = max(a, c - r)
    res2 = min(b, c + r)
    print(max(0, b - a - max(0, res2 - res1)))

for _ in range(int(input())):
	a,b,c,r = map(int,input().split())
	if a > b: a,b = b,a
	x = max(c-r,a)
	y = min(c+r,b)
	ans = b-a
	ans -= max(0,y-x) 
	print(max(ans,0))		

for _ in range(int(input())):
    a, b, c, r = list(map(int, input().split()))
    if a > b:
        a, b = b, a
    x, y = c - r, c + r
    d = max(0, min(b, y) - max(x, a))
    print(b - a - d)


t = int(input())

for _ in range(t):
    a, b, c, r = list(map(int, input().strip().split()))
    a, b = min(a,b), max(a, b)
    
    low = max(a, c-r)
    high = min(b, c+r)
    unavaialbe = high - low
    unavaialbe = max(unavaialbe, 0)
    print(b - a - unavaialbe)


t = int(input())
while t>0:
    t-=1
    a,b,c,r = map(int,input().split())
    if a>b:
        a,b=b,a
    print(min(max((c-r)-a,0)+max(b-(c+r),0),abs(b-a)))

t = int(input())
for _ in range(t):
    a, b, c, r = list(map(int, input().split()))
    if b < a:
        a, b = b, a
    ans = 0
    if c < a:
        if c + r < a:
            ans = b - a
        else:
            ans = max(b - (c + r), 0)
    elif c > b:
        if c - r > b:
            ans = b - a
        else:
            ans = max((c - r) - a, 0)
    else:
        ans += max(0, b - (c + r)) + max(0, c - r - a)
    print(ans)


from sys import stdin, exit
from math import *

def main():
    def len_intersect(a, b, c, d):
        if d <= a or c >= b:
            return 0
        u, v = (max(a, c), min(b, d))
        return max(0, v - u)

    for testcase in range(int(stdin.readline())):
        a, b, c, r = list(map(int, stdin.readline().split()))
        if a > b:
            a, b = b, a
        print(b - a - len_intersect(a, b, c - r, c + r))

def __starting_point():
    main()

__starting_point()

for i in range(int(input())):
    a,b,c,r=map(int,input().split())
    x=c-r
    y=c+r
    if a>b:a,b=b,a
    z=max(0,min(y,b)-max(x,a))
    print(b-a-z)