Alice is a system administrator managing a critical server farm. There are n pending tasks in the execution queue, task1, task2, ..., taskn from highest to lowest priority. Currently, Alice's urgent job is at the very end of the queue (lowest priority). Each task i has a complexity rating of ai. Alice needs to move her job to the front of the queue (highest priority) to ensure it executes first.
Alice can perform the following operations any number of times:
Alice wants to determine the minimum total cost (processing credits) required to move her job to the front of the entire queue.
You need to calculate the answer for the complete task array [a. a2, ..., an].
Note: Input and Output may be incorrect