There is a device in Inazuma, like the picture shows. It contains some stones(placed in a line) and each stone has one to three gleamy petals on it. If one stone is knocked, the gleamy petals on it and the adjacent stone(if has) will change as follow:
1->2
2->3
3->1
The first line is a single integer—the number of stones.
The second line contains n integersrepresenting the number of bright petals on each stone in order.
The input is guaranteed to have a solution.
A line contains n integersrepresenting the knock times of each stone in order.
If there are more than one answer, output the answer had the minimum total knock times. If there are still more than one answer had the minimum total knock times, output the answer had the minimum lexicographical order of them.