Problems
Four Chips (Hard)
Four Chips (Hard)
There is a \textbf{n}×\textbf{1} board. Its cells are numbered with integers from \textbf{1} to \textbf{n}. First four cells have indistinguishable chips in them. In one turn you can move one chip to the neighbouring cell or move it symmetrically relatively any other chip (i.e. if you move a chip in cell \textbf{10} symmetrically relative to the chip in cell \textbf{13} it will end up in cell \textbf{16}), given that the chip won't leave the board and each cell will have no more than one chip. You need to determine the minimum number of turns needed to reach a certain configuration of chips.
\InputFile
The first line of input contains number \textbf{T} (\textbf{1} ≤ \textbf{T} ≤ \textbf{10000}) --- the amount of test cases. Next \textbf{T} lines consist of four integers \textbf{a_1}, \textbf{a_2}, \textbf{a_3} and \textbf{a_4} (\textbf{1} ≤ \textbf{a_1}, \textbf{a_2}, \textbf{a_3},\textbf{ a_4} ≤ \textbf{n}, \textbf{n} = \textbf{70}) --- the numbers of cells where the chips should be in the final configuration.
\OutputFile
For each test case print single integer - the answer to the problem in the statement.
Input example #1
2 1 2 3 4 1 3 4 6
Output example #1
0 1