As it says, Time is Money, Efficiency is Life. A client has a computing task waiting for uploading to the cloud servers. However, due to the resource limits and many other tasks, a task usually cannot be worked on a single server but multiple servers, one after another. You, as an employee of a cloud server provider who specializes in task allocation, need to select several servers from a limited number of cloud servers to perform calculations. We know that even the same servers will perform differently in different environments.
There are n cloud servers available in the vicinity of the client's region numbered from 1 to n. The iii-th cloud server has two parameters: wiw_iwi and pip_ipi, which indicate the computing power and transmission efficiency of that server, respectively. The supervisor requires that each task must be computed by exactly mmm of these servers. The client's computational task is not parallelizable, so you must sequence the work of the mmm servers to maximize the total computational efficiency. We define the total computational efficiency as follows:
i=1∑mwaij=0∏i−1paj
where a1,a2,…,ama_1,a_2,\ldots, a_ma1,a2,…,am (pairwise distinct, 1≤ai≤n1\le a_i \le n1≤ai≤n) are the servers you selected. For convenience, a0=0,p0=1a_0 = 0, p_0 = 1a0=0,p0=1.