Mid semester exams are approaching and 'IDC' wants to study with the toppers of the batch.
So he decide to take a temporary room near all the toppers of the computer science batch.

All room are on a straight line and room numbers are integers. 
Since he is very lazy and doesnt want to walk. He wants to visit all the toppers everyday
to collect notes so selects a room which minimises the distance he has to walk everyday.

Constraints:
1 ≤ T ≤ 100
1 ≤ Room Number(Integer) ≤ 100
1 ≤ N ≤20

Input:
First line of input contains T, number of testcases.
First line of each line of testcase contains N, number of toppers. Next line contains room numbers of N toppers space separated.

Output:
Output contains T lines, each line will contains the minimum distance he has to walk each day.

SAMPLE INPUT
2
4
24 13 89 37
6
7 30 41 14 39 42

SAMPLE OUTPUT
152
70
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
for tc in xrange(input()):
	k = input()
	n = map(int,raw_input().split())
	n.sort()
	ans=0
	for i in range(1,k):
		ans += n[i]-n[i-1]
	print ans*2