You have chopsticks, numbered from to . Initially, chopstick has length .
There are pieces of sushi, numbered from to . Sushi must be eaten using chopsticks and .
When you eat a piece of sushi, compare the current lengths of its two chopsticks. If they differ, shorten the longer chopstick until the two lengths are equal. If they are equal, neither chopstick is changed.
Each chopstick may be used any number of times, but it may be shortened at most once in total.
Find an order in which to eat all the sushi that minimizes the total length removed from the chopsticks. Output this minimum total and one optimal order. If several optimal orders exist, output any of them.
Different pieces of sushi may require the same pair of chopsticks. A valid order always exists.
For each test case, print the minimum total length removed as on the first line. On the second line, print a permutation of , where sushi is eaten on turn . This order must attain the printed minimum and shorten each chopstick at most once. If several optimal orders exist, print any of them.