Sequence is beautiful and the beauty of an integer sequence is defined as follows: removes all but the first element from every consecutive group of equivalent elements of the sequence (i.e. unique function in C++ STL) and the summation of rest integers is the beauty of the sequence.
Now you are given a sequence $A$ of $n$ integers $\{a_1,a_2,...,a_n\}$. You need find the summation of the beauty of all the sub-sequence of $A$. As the answer may be very large, print it modulo $10^9+7$.
Note: In mathematics, a sub-sequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example $\{1,3,2\}$ is a sub-sequence of $\{1, 4, 3, 5, 2, 1\}$.