Jimmy have to calculate a function where and are both integers in the range from to . When he knows , he can easily derive , where is any integer from it by applying some simple calculations involving and .
Note that the function is not symmetric, so can not be derived from .
For example if , he only needs to know the answers for out of the possible input value combinations:
The other can be derived from them:
и из ;
из ;
из ;
Consists of at most lines. Each line contains an integer . The last line contains one zero and should not be processed.
For each input value of print in a separate line the minimum number of function values Jimmy needs to know to compute all values .