Initialize a stack to keep track of indices of elements in increasing order (monotonic stack).
Initialize a variable sumOfMinimums to store the running total of subarray minimums.
Iterate through each element in the array.
a. Pop elements from the stack while the current element is less than or equal to the element at the top of the stack.
b. For each popped element, calculate its contribution to the sum based on the distance to the previous smaller element and the current index.
c. Push the current index onto the stack.
After iterating through all elements, pop any remaining elements from the stack and calculate their contribution.