python 1856
\tclass Solution:\n\t\tdef maxSumMinProduct(self, nums: List[int]) -> int:\n\t\t\tnums.append(0)\n\t\t\tans = 0\n\t\t\tstack = []\n\t\t\tprefix = [0] + list(acc
\tclass Solution:\n\t\tdef maxSumMinProduct(self, nums: List[int]) -> int:\n\t\t\tnums.append(0)\n\t\t\tans = 0\n\t\t\tstack = []\n\t\t\tprefix = [0] + list(accumulate(nums))\n\n\n\t\t\tfor i,num in enumerate(nums):\n\t\t\t\twhile stack and nums[stack[-1]] > num:\n\t\t\t\t\tminval = nums[stack.pop()]\n\t\t\t\t\tif not stack:\n\t\t\t\t\t\tsumm = prefix[i]\n\t\t\t\t\telse:\n\t\t\t\t\t\tsumm = prefix[i]-prefix[stack[-1]+1]\n\t\t\t\t\tans = max(ans,minval*summ)\n\n\t\t\t\tstack.append(i)\n\n\t\t\treturn (ans% int(1e9+7))
['Stack', 'Python']