<p>As the ruler of a kingdom, you have an army of wizards at your command.</p>
<p>You are given a <strong>0-indexed</strong> integer array <code>strength</code>, where <code>strength[i]</code> denotes the strength of the <code>i<sup>th</sup></code> wizard. For a <strong>contiguous</strong> group of wizards (i.e. the wizards' strengths form a <strong>subarray</strong> of <code>strength</code>), the <strong>total strength</strong> is defined as the <strong>product</strong> of the following two values:</p>
<ul>
<li>The strength of the <strong>weakest</strong> wizard in the group.</li>
<li>The <strong>total</strong> of all the individual strengths of the wizards in the group.</li>
</ul>
<p>Return <em>the <strong>sum</strong> of the total strengths of <strong>all</strong> contiguous groups of wizards</em>. Since the answer may be very large, return it <strong>modulo</strong><code>10<sup>9</sup> + 7</code>.</p>
<p>A <strong>subarray</strong> is a contiguous <strong>non-empty</strong> sequence of elements within an array.</p>