Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Collectors Problem

By Peregrine_Falcon · Limits 1s, 512 MB

The Bat club controls Gotham City. They decided to bring equality to the city (Of course, with some profits in their pocket). There are NN people in the city. The ithi^{th} person has DiD_i dollars in his/her bank account. To bring equality in the bank balance of the people of Gotham City, the Bat club appointed a collector. The Bat club has offered MM packages to the collector. The ithi^{th} package has a value of PiP_i and the collector has to pay SiS_i dollars for the package. The collector has to choose a package. If the collector chooses the ithi^{th} package, he has to make everyone’s bank balance equal to PiP_i dollars. If a person has more than PiP_i dollars in his/her bank account, the collector will take the rest of the money leaving PiP_i dollars in his/her account. If a person has less than PiP_i dollars, the collector will add the necessary amount of dollars to make the bank balance equal to PiP_i dollars.

The collector wants to maximize his profit from this job. In case if he is unable to make any profit, he wants to minimize his loss. The collector asked your help to choose a package wisely and accurately estimate his maximum profit or minimum loss.

Please note that the collector must buy a package even if there is not a need for any changes in bank balances.

Input

The first line of input will consist of two integers NN and MM (1N,M2×105)(1 \leq N, M \leq 2 × 10^5).
The second line will consist MM integers PiP_i (1Pi109)(1 \leq P_i \leq 10^9).
The third line will consist of MM integers SiS_i (1Si109)(1 \leq S_i \leq 10^9).
The fourth line will consist of NN integers DiD_i (1Di109)(1 \leq D_i \leq 10^9).

Output

In the case of profit, print ProfitProfit XX. Here, XX stands for maximum profit the collector can make.
In the case of loss, print LossLoss XX. Here, XX stands for minimum loss the collector has to face.
Otherwise, print NeutralNeutral. If there is no profit or loss.

Samples

InputOutput
5 2
3 2
2 4
1 8 2 3 4
Profit 4

If the collector chooses the first package, he has to make everyone's bank balance equal to 3. To make everyone's bank balance equal to 3 dollars, he can adjust the bank balances of the account holders by adding the following amounts respectively: -2, +5, -1, 0, +1. That leaves 3 dollars in his pocket. Additionally, he has to pay 2 dollars to the Bat club. That leaves only 1 dollar of profit.

And if he chooses the second package, he has to make everyone's bank balance equal to 2 dollars. To make everyone's bank balance equal to 2 dollars he can make -1, +6, 0, +1, +2. That leaves 8 dollars in his pocket. Additionally, he has to pay 4 dollars to the Bat club. That leaves 4 dollars of profit.

So the answer is 4 dollars.

InputOutput
3 1
2
1
2 3 1
Loss 1
InputOutput
3 1
3
2
5 2 4
Neutral

    Discussion

    Statistics


    92% Solution Ratio

    ishaan_007Earliest, 2w ago

    FrdhsnFastest, 0.0s

    PranabLightest, 1.8 MB

    monna4335Shortest, 469B

    Submit

    Login to submit

    Editorial

    What is the total amount of money in everyone's bank account if the collector chooses the ithi^{th}i...

    Toph uses cookies. By continuing you agree to our Cookie Policy.