Three friends are going to meet each other. Initially, the first friend stays at the position $x = a$, the second friend stays at the position $x = b$ and the third friend stays at the position $x = c$ on the coordinate axis $Ox$.

In one minute each friend independently from other friends can change the position $x$ by $1$ to the left or by $1$ to the right (i.e. set $x := x - 1$ or $x := x + 1$) or even don't change it.

Let's introduce the total pairwise distance — the sum of distances between each pair of friends. Let $a'$, $b'$ and $c'$ be the final positions of the first, the second and the third friend, correspondingly. Then the total pairwise distance is $|a' - b'| + |a' - c'| + |b' - c'|$, where $|x|$ is the absolute value of $x$.

Friends are interested in the minimum total pairwise distance they can reach if they will move optimally. Each friend will move no more than once. So, more formally, they want to know the minimum total pairwise distance they can reach after one minute.

You have to answer $q$ independent test cases.


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 1000$) — the number of test cases.

The next $q$ lines describe test cases. The $i$-th test case is given as three integers $a, b$ and $c$ ($1 \le a, b, c \le 10^9$) — initial positions of the first, second and third friend correspondingly. The positions of friends can be equal.


-----Output-----

For each test case print the answer on it — the minimum total pairwise distance (the minimum sum of distances between each pair of friends) if friends change their positions optimally. Each friend will move no more than once. So, more formally, you have to find the minimum total pairwise distance they can reach after one minute.


-----Example-----
Input
8
3 3 4
10 20 30
5 5 5
2 4 3
1 1000000000 1000000000
1 1000000000 999999999
3 2 5
3 2 6

Output
0
36
0
0
1999999994
1999999994
2
4
[{"code": "t=int(input())\nfor nt in range(t):\n\ta,b,c=map(int,input().split())\n\tprint (max(0,abs(a-b)+abs(b-c)+abs(a-c)-4))", "passed": true, "time": 0.68, "memory": 14096.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    a,b,c = map(int, input().split())\n    pd = abs(a-b) + abs(b-c) + abs(a-c)\n    for x in range(-1, 2):\n        for y in range(-1, 2):\n            for z in range(-1, 2):\n                a1, b1, c1 = a+x, b+y, c+z\n                pd = min(pd, abs(a1-b1) + abs(b1-c1) + abs(a1-c1))\n    print(pd)", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "q = int(input())\n\nfor case in range(q):\n    a, b, c = list(map(int, input().split()))\n    sm = abs(c - a) + abs(b - a) + abs(b - c)\n    ans = max(0, sm - 4)\n    print(ans) ", "passed": true, "time": 0.29, "memory": 14096.0, "status": "done"}, {"code": "for _ in range(int(input())):\n\tl=sorted(list(map(int,input().split())))\n\tans=2*(l[2]-l[0])\n\tfor i in [-1,0,1]:\n\t\tfor j in [-1,0,1]:\n\t\t\tfor k in [-1,0,1]:\n\t\t\t\tL=list(l)\n\t\t\t\tL[0]+=i\n\t\t\t\tL[1]+=j\n\t\t\t\tL[2]+=k\n\t\t\t\tL.sort()\n\t\t\t\tans=min(ans,2*(L[2]-L[0]))\n\tprint(ans)\n", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "t = int(input())\nfor i in range(t):\n    a,b,c = sorted(map(int,input().split()))\n    res = 10 ** 100\n    for p in range(-1, 2):\n        for q in range(-1, 2):\n            for r in range(-1, 2):\n                aa = a + p\n                bb = b + q\n                cc = c + r\n                tmp = abs(aa - bb)\n                tmp += abs(aa - cc)\n                tmp += abs(cc - bb)\n                res = min(res, tmp)\n    print(res)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n# coding: utf-8\n# Last Modified: 12/Dec/19 07:08:37 PM\n\n\nimport sys\n\n\ndef main():\n    for tc in range(int(input())):\n        a, b, c = get_ints()\n        A = [a - 1, a, a + 1]\n        B = [b - 1, b, b + 1]\n        C = [c - 1, c, c + 1]\n        ans = 10 ** 18\n        for i in range(3):\n            for j in range(3):\n                for k in range(3):\n                    ans = min(\n                        ans, abs(A[i] - B[j]) + abs(A[i] - C[k]) + abs(B[j] - C[k])\n                    )\n        print(ans)\n\n\nget_array = lambda: list(map(int, sys.stdin.readline().split()))\n\n\nget_ints = lambda: list(map(int, sys.stdin.readline().split()))\n\n\ninput = lambda: sys.stdin.readline().strip()\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.29, "memory": 14032.0, "status": "done"}, {"code": "q = int(input())\nfor i in range(q):\n    [a,b,c] = list(map(int, input().rstrip().split()))\n    mi = min(a,b,c)\n    ma = max(a,b,c)\n    altro = a+b+c-mi-ma\n    if mi == ma:\n        print(0)\n    elif ma - mi == 1:\n        print(0)\n    else:\n        mi += 1\n        ma -= 1\n        print (2*(ma - mi))", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    a, b, c = map(int, input().split())\n    ret = float('inf')\n    for da in (-1, 0, 1):\n        for db in (-1, 0, 1):\n            for dc in (-1, 0, 1):\n                na, nb, nc = a + da, b + db, c + dc\n                ret = min(ret, abs(na - nb) + abs(na - nc) + abs(nb - nc))\n    print(ret)", "passed": true, "time": 0.21, "memory": 14176.0, "status": "done"}, {"code": "for _ in ' '*int(input()):\n    a,b,c = map(int,input().split())\n    print(max(abs(a-b)+abs(a-c)+abs(b-c)-4,0))", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "import sys\nimport math\nt = int(input())\nfor _ in range(t):\n    a, b, c = list(map(int, input().split()))\n    maxL = min(a, b, c)\n    maxR = max(a, b, c)\n    maxR -= 1\n    maxL += 1\n    print(max(0, (maxR - maxL) * 2))", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "Q = int(input())\nfor _ in range(Q):\n    a, b, c = tuple(map(int, input().split()))\n\n    A = [a - 1, a, a + 1]\n    B = [b - 1, b, b + 1]\n    C = [c - 1, c, c + 1]\n\n    comps = []\n    for x in A:\n        for y in B:\n            for z in C:\n                comps.append((x, y, z))\n\n    ans = float('inf')\n    for a, b, c in comps:\n        ans = min(ans, abs(a - b) + abs(a - c) + abs(b - c))\n\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "import sys\n\nq = int(sys.stdin.readline())\n\ndef dist(x, y, z):\n\treturn abs(x - y) + abs(x - z) + abs(y - z)\n\ndef solve(a, b, c):\n\tbest_dist = 10**18\n\tfor ax in [-1, 0, 1]:\n\t\tfor bx in [-1, 0, 1]:\n\t\t\tfor cx in [-1, 0, 1]:\n\t\t\t\tbest_dist = min(best_dist, dist(a + ax, b + bx, c + cx))\n\treturn best_dist\n\nfor _ in range(q):\n\ta, b, c = map(int, sys.stdin.readline().strip().split(' '))\n\tprint(solve(a, b, c))", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "test = int(input())\nfor _ in range(test):\n    ans = 10**10\n    a,b,c = map(int,input().split())\n    for i in range(-1,2):\n        for j in range(-1,2):\n            for k in range(-1,2):\n                ta = a+i\n                tb = b+j\n                tc = c+k\n                ans = min(ans,abs(ta-tb)+abs(tb-tc)+abs(ta-tc))\n    print(ans)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "q = int(input())\nfor numbers in range(q):\n    a,b,c = list(map(int,input().split()))\n    x = max(a,b,c)\n    y = min(a,b,c)\n    if x - y <=2 :\n        print(0)\n    else:\n        print(2*(x-y-2))\n        \n\n", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}]