Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given a 0-indexed integer array nums representing the strength of some heroes. The power of a group of heroes is defined as follows:

Let i0, i1, ... ,ik be the indices of the heroes in a group. Then, the power of this group is max(nums[i0], nums[i1], ... ,nums[ik])2 * min(nums[i0], nums[i1], ... ,nums[ik]).

Return the sum of the power of all non-empty groups of heroes possible. Since the sum could be very large, return it modulo 109 + 7.
 
Please complete the following python code precisely:
```python
class Solution:
    def sumOfPower(self, nums: List[int]) -> int:
```