t = int(input())for i in range(1,t+1): n = int(input()) a = [int(x) for x in input().split()] print((max(a)-min(a))*2)