#!/usr/bin/env python for i in range(int(input())): input() a = list(map(int, input().split())) print(max(a)-min(a)<<1)