LearnPy Hub
← Arena
AdvancedRating 1900

Shortest Round Trip

Visit every city exactly once, starting and ending at city 1. Print the shortest total distance.

Input

n (≤ 13); then an n × n distance table.

Output

One integer.

Sample 1

Input
4
0 10 15 20
10 0 35 25
15 35 0 30
20 25 30 0
Output
80

Sample 2

Input
1
0
Output
0
solution.py
Output appears here
Shortest Round Trip · Python Arena problem · LearnPy Hub