A king possesses vacant houses within his town, arranged in an N∗M matrix. Each house is currently unoccupied. Within the town, there are introverted and extroverted individuals seeking residence.
When the king allocates a house to an introvert, he gains 360 rupees; if given to an extrovert, he gains 120 rupees.
However, for each person residing near an introvert, the king incurs a loss of 90 rupees, whereas for each person near an extrovert, he gains 60 rupees.
The objective is to determine the maximum profit achievable by the king. The allocation of accommodation to all individuals is not mandatory; the primary goal is to optimize the king's profit.
A person is called residing near another person if they live in the directly adjacent cells north, east, south, and west of a person's cell.
Input Format:
The one and only line contains 4 integers N, M, X (no of introverts) and Y (no of extroverts).
Output Format:
Print one integer - the maximum profit achievable by the king
Constraints:
1≤N,M≤50≤X,Y≤6
The Introvert will give 360 rupees while each extrovert will give 120 rupees. Since both the extroverts have 1 person next to them the king will gain (60*2) rupees more and hence the total profit is 720 rupees. It can be shown that no other combination can gain more than 720 rupees.