Your algorithm is so good at predicting the market that you now know what the share price of Mahindra & Mahindra. (M&M) will be for the next N days.

Each day, you can either buy one share of M&M, sell any number of shares of M&M that you own, or not make any transaction at all. What is the maximum profit you can obtain with an optimum trading strategy?

Input

The first line contains the number of test cases T. T test cases follow:

The first line of each test case contains a number N. The next line contains N integers, denoting the predicted price of M&M shares for the next N days.

Output

Output T lines, containing the maximum profit which can be obtained for the corresponding test case.

Constraints

1 ≤ T ≤ 10
1 ≤ N ≤ 50000

All share prices are between 1 and 100000

SAMPLE INPUT
3
3
5 3 2
3
1 2 100
4
1 3 1 2

SAMPLE OUTPUT
0
197
3

Explanation

For the 1st case, you cannot obtain any profit because the share price never rises.
For the 2nd case, you can buy one share on the first two days, and sell both of them on the third day.
For the 3rd case, you can buy one share on day 1, sell one on day 2, buy one share on day 3, and sell one share on day 4.
def calcprofit(stockvalues):
    prof=0
    m=0
    for i in range(len(stockvalues)-1,-1,-1):
        ai=stockvalues[i]
        if m<=ai:
            m=ai
        prof+=m-ai
    return (prof)  
for iti in xrange(input()):
	n=input()
	l=map(int, raw_input().split())
	print calcprofit(l)