There is a lottery winner who has lives in a house which has R∗C rooms such that there are R rows where each row has C rooms and C columns and each column has R rooms, he will receive N coins worth Xi $ as a winner. He will place each coin in one of R∗C rooms and also note that more than one coin can be placed in a single room. You will be given which rooms he has chosen. Now robbers have known about the coins and want to loot him as much as possible. Robbers will do the following:
If they rob coin i, they will get an amount worth Xi and it is obivious that robbed coins will not be persent. They will rob optimally.
What is the maximum possible sum of amount robbers can rob?
Input format
Output format
For each test case:
Constraints
First Robber R1 will choose 5, second robber R2 will choose 3, third robber R3 will choose 4 and finally 4th robber R4 will choose 2.
So sum=2+3+4+5=14.