A firm occupies a 10-floors building. After finishing the work day, clerk John has to carry identical packages between floors. He starts and ends this job on floor 1 and can carry only one package.
Write a program that finds the minimum number m of the climbed floors and with the corresponding way of traveling.
The required deliveries are in the text file INPUT.TXT as follows:
The deliveries are numbered in order they appear in the file: 1,2,...,k. Output is in the file in the following format:
|Here is one possible answer
for the given example. The output OUTPUT.TXT consists of: