P13848 [CodeChef] bycd1602
NOI
题目描述

Problem Statement
A mountain hiker is descending from the mountain ranges. There are many mountains along his way each with it's own height. He will descend from
mountain only if the mountains' height ahead of him are Non Increasing.

You are given the height of the mountains ahead of you. Your task is to determine the minimum amount of height you have to reduce from the mountains
ahead of the hiker in order to complete his expedition.

Input
Input description.

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows
The first line of each test case contains a single integer N denoting the number of mountains ahead of him.
The second line contains N space-separated integers A1, A2, ..., AN denoting the height of the mountains.

Output
Output description.

For each test case, output a single line containing the answer.

Constraints

1 ≤ T ≤ 100
1 ≤ N ≤ 10^7
1 ≤ Ai ≤ 10^7

Example
Input:
1
5
3 2 4 1 2

Output:
3

输入格式

见题面

输出格式

见题面

样例输入
1 5 3 2 4 1 2
样例输出
3