Chiaki has $n$ integers $s_0,s_1,\dots,s_{n-1}$. She has defined an infinite sequence $S$ in the following way: $S_k = s_{k \bmod n} + n \cdot \lfloor \frac{k}{n} \rfloor$, where $k$ is a zero based index.
For a continuous subsequence $S[l..r]$, let $cnt_x$ be the number of occurrence of $x$ in the subsequence $S[l..r]$. Then the value of $S[l..r]$ is defined as follows $$f(l,r)=\sum\limits_{x}x \cdot cnt^2_x$$
For two integers $a$ and $b$ ($a \le b$), Chiaki would like to find the value of $$(\sum\limits_{a \le l \le r \le b} f(l,r)) \bmod (10^9+7)$$