
Christmas is quickly approaching, so Nathan needs to buy gifts for each of his
However, Nathan has not bought any of the gifts yet! He looks online and finds
Unfortunately for Nathan, the shopkeepers are not in a very festive mood. Before he visits any shop, the shopkeepers can work together to adjust the prices of their gifts. In particular, the price of the
Nathan would like to know the minimum cost of buying gifts for all of his friends. Can you help him?
Constraints
Subtask | Points | ||
---|---|---|---|
1 | 5 | ||
2 | 15 | ||
3 | 20 | ||
4 | 60 |
All prices will be a positive integer no greater than
Input Specification
The first line will contain three space-separated integers,
Output Specification
Output a single integer, the minimum cost to buy gifts for all of Nathan's friends.
Sample Input
5 3 3
2 4 3
1 5 2
3 1 3
6 2 1
4 3 2
Sample Output
33
Explanation for Sample Output
Nathan can go to shops
Comments