Stack + Prefix sum. One pass. Simple and clear solution
\nclass Solution:\n    def maxSumMinProduct(self, nums: List[int]) -> int:\n        prefix_sum, ans, stack = 0, 0, [(0, 0)]\n        nums.append(0)\n        for
```\nclass Solution:\n    def maxSumMinProduct(self, nums: List[int]) -> int:\n        prefix_sum, ans, stack = 0, 0, [(0, 0)]\n        nums.append(0)\n        for num in nums:\n            while num < stack[-1][0]:\n                min_subarr, _ = stack.pop() \n                ans = max(min_subarr * (prefix_sum - stack[-1][1]), ans) \n            prefix_sum += num\n            stack.append((num, prefix_sum))\n        return ans % (10**9+7)\n```
['Monotonic Stack', 'Prefix Sum', 'Python3']