For each test, output one line containing a single integer-the minimal cost
2 7 3 2 2 3 4 4 5 5 6 2 0 3 3 4 8 9
3 5