You are given a permutation x of the integers from 1 to n.
You want to sort this permutation by a sequence of operations. In one operation, you select two adjacent elements x_i and x_i+1 such that x_i>x_i+1 and swap them. When there are multiple choices of such i, you choose one of them with equal probability. When there is no such i, the process ends.
The cost of swapping x_i and x_i+1 is ∣x_i−x_i+1∣. Calculate the expected total cost of sorting the permutation modulo 109+7.
The first line of input contains an integer n (1≤n≤106).
The second line contains n integers x_1,x_2,…,x_n (1≤x_i≤n). It is guaranteed that x is a permutation of the integers from 1 to n.
Print a single line containing an integer: the expected total cost modulo 109+7.
Formally, it can be shown that the expected total cost can be represented as a fraction p/q for some coprime non-negative integers p and q. For example, if the expected total cost is an integer, then we just have q=1. You have to print the value p⋅q−1mod(109+7).