Connect-the-dots is a new popular game on iPad. At the onset of the game, n random numbers of dot are placed on the screen. The ith dot has the coordinate of (xi, yi). The player must connect all the dots via straight line-segments so that no dot is isolated. The game is scored as follows:
Sum of integral length of edge(i, j) for all line-segments i-j.
The integral length of edge (i, j) is computed as |yi-yj|+|xi-xj|. Write a program to compute and output the minimum possible score.
First line contains an integer indicating the number of test cases to follow. For each test case, coordinates of random number of dots are given. The coordinate of “-1 -1” indicates the end of a test case. There are can be at most 5000 dots. The coordinates are all positive integer between 0 and 1000.
For each test case, output the minimum score possible when all the dots are inter-connected.
若題目沒有特別說明，則應該以多測資的方式讀取，若不知如何讀取請參考 a001 的範例程式。2
1 1 2 2 3 3 -1 -1
0 1 1 0 1 1 0 0 -1 -1
Sample Output ：