Lopsided Lineup

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Together with your coworker, Sergey, you are organizing the exciting Billiards and Pool Competition for your coworkers in your small company. However, communication has not been great between you two. You are not sure you and Sergey think alike, but as far as you are concerned, this would be a great opportunity to do some team building. The actual prizes are meaningless, but there is possibly a lot to be gained from this in team bonding. You want to maximise result.

You start reading some pseudo-scientific books on team management, and after some research, you conclude that there are two good ways of team bonding: people feel more connected after either a triumphant victory or a crushing defeat. This gives you a great idea: if you divide your coworkers into two groups that are as far apart in skill level as possible, both teams will experience improved bonding! You therefore think it is optimal to try to make the teams as unbalanced as possible. Make sure, however, that the teams are of equal size.

With a bit of work you come up with a nice model for the strength of a team. You think team strength is mainly determined by how well two players play together, whether they encourage one another and complement each other's weaknesses. Whenever two players ii and jj are in the same team, they increase the team score by an integer c_i,jc\_{i,j}. The total score of a team is thus equal to the sum of c_i,jc\_{i,j}, over all unordered pairs of players ii and jj in the team.

입력

The input consists of:

  • One line with an even integer nn (2n10002\leq n\leq 1000), the total number of players.
  • nn lines, the iith of which contains nn integers c_i,1,c_i,2,,c_i,nc\_{i,1}, c\_{i,2}, \dots, c\_{i, n} (106c_i,j106-10^6 \leq c\_{i,j} \leq 10^6). For any ii and jj, it is guaranteed that c_i,i=0c\_{i,i} = 0 and c_i,j=c_j,ic\_{i,j} = c\_{j,i}.

출력

Output the maximum possible difference in strength between two teams of equal size.