There are n containers (1≤n≤4). At the start every container is completely full of water. The capacity of the i-th container is an integer oi liters, with 1≤oi≤49.
Three kinds of moves are allowed:
Given the capacity of every container and the requested final amount of water in every container, decide whether some sequence of allowed moves reaches that final state. If it does, output the minimum number of moves; otherwise output NIE.
The first line contains one integer n, the number of containers (1≤n≤4). The second line contains n integers o1,…,on separated by single spaces, where oi is the capacity of the i-th container (1≤oi≤49). The third line contains n integers w1,…,wn separated by single spaces, where wi is the requested final amount of water in the i-th container (0≤wi≤oi).
If the requested final state cannot be reached using only the allowed moves, print the single word NIE. Otherwise print one integer: the minimum number of moves that reaches the requested final state.