A time to scatter stones
On the table, there are N boxes arranged in a row. Each box is either empty or contains a certain number of pebbles. In one move, you can choose to:
Take one pebble from an end box and move it to the adjacent box.
Take two pebbles from a box that is not at the end and place one pebble in each of its neighboring boxes.
Your task is to determine if it's possible to rearrange the pebbles to match a specific desired configuration. If it is possible, you need to calculate the minimum number of moves required to achieve this configuration.
Input
The first line contains a single natural number N – the number of boxes, where 2 ≤ N ≤ 20.
The second line contains N non-negative integers a_i, separated by spaces, where a_i represents the current number of pebbles in the i-th box, with 0 ≤ a_i ≤ 100. The total sum of all a_i does not exceed 100.
The third line contains N non-negative integers b_i, separated by spaces, where b_i represents the desired number of pebbles in the i-th box, with 0 ≤ b_i ≤ 100.
Output
If it is not possible to achieve the desired arrangement of pebbles, output No solution on the first line. If it is possible, output a single integer on the first line – the minimum number of moves required to reach the desired arrangement.