Sigma of Permutations Given a permutation p of numbers 1, 2, ..., n. Let's define $f(p)$ as the following sum:
$$\large f(p)=\sum_{i=1}^n\sum_{j=i}^n\min({\rm p}_i,{\rm p}_{i+1},...,{\rm p}_j)$$
What is the exact job of this sigma I can't understand it, what is the result of it.                      Would you please explain it by sample example.
Sorry if my question is silly but would you please help me to figure it out.


The sum is equal to $$\sum_{k=1}^{n}kW_k$$ 
  where $W_n$ is the width of the interval around $n$ in the permutation that contains only numbers larger than or equal to $k$.

For example: 
For the permutation $(1,4,3,2)$ we have 
$$\begin{align}W_1=4\qquad\text{ because }\qquad(\overline{1,4,3,2})\\W_2=3\qquad\text{ because }\qquad(1,\overline{4,3,2})\\W_3=2\qquad\text{ because }\qquad(1,\overline{4,3},2)\\W_4=1\qquad\text{ because }\qquad(1,\overline{4},3,2)\end{align}$$
So, the sum is equal to $$4\cdot1+3\cdot2+2\cdot3+1\cdot4=20$$
For the permutation $(132)$ we have 
$$\begin{align}W_1=3\qquad\text{ because }\qquad(\overline{1,3,2})\\W_2=2\qquad\text{ because }\qquad(1,\overline{3,2})\\W_2=1\qquad\text{ because }\qquad(1,\overline{3},2)\end{align}$$
So, the sum is equal to $$3\cdot1+2\cdot2+1\cdot3=10$$
