You were just hired as CEO of the local junkyard.One of your jobs is dealing with the incoming trash and sorting it for recycling.The trash comes every day in N containers and each of these containers contains certain amount of each of the N types of trash. Given the amount of trash in the containers find the optimal way to sort the trash. Sorting the trash means putting every type of trash in separate container. Each of the given containers has infinite capacity. The effort for moving one unit of trash
from container i to j is 1 if i ≠ j otherwise it is 0.You are to minimize the total effort.
Input
The first line contains the number N (1 ≤ N ≤ 150), the rest of the input contains the descriptions of the containers.The (1 + i)-th line contains the description of the i-th container the j-th amount (0 ≤ amount ≤ 100) on this line denotes the amount of the j-th type of trash in the i-th container.
Output
You should write the minimal effort that is required for sorting the trash.
Sample
input | output |
---|
4
62 41 86 94
73 58 11 12
69 93 89 88
81 40 69 13
| 650 |
Problem Author: Jivko Ganev