Java Solution using prefix and stack. 42 ms, faster than 74.40%
\'\'\'\n\n\tpublic int maxSumMinProduct(int[] nums) {\n\t\tfinal long kmod = (long) 1e9 + 7;\n\n\t\tlong ans = 0;\n\t\tStack stack = new Stack<>();\n\t\tlong[] 
\'\'\'\n\n\tpublic int maxSumMinProduct(int[] nums) {\n\t\tfinal long kmod = (long) 1e9 + 7;\n\n\t\tlong ans = 0;\n\t\tStack<Integer> stack = new Stack<>();\n\t\tlong[] prefix = new long[nums.length + 1];\n\n\t\tfor (int i = 0; i < nums.length; ++i)\n\t\t  prefix[i + 1] = prefix[i] + nums[i];\n\n\t\tfor (int i = 0; i <= nums.length; ++i) {\n\t\t  while (!stack.isEmpty() && (i == nums.length || nums[stack.peek()] > nums[i])) {\n\t\t\tfinal int minVal = nums[stack.pop()];\n\t\t\tfinal long sum = stack.isEmpty() ? prefix[i] : prefix[i] - prefix[stack.peek() + 1];\n\t\t\tans = Math.max(ans, minVal * sum);\n\t\t  }\n\t\t  stack.push(i);\n\t\t}\n\n\t\treturn (int) (ans % kmod);\n}\n\n\'\'\'
['Stack', 'Java']