Try to follow the clever priest’s strategy and calculate the number of transfer using four needles but according with the fixed and immutable laws of Brahma, which require that the priest on duty must not move more than one disc at a time and that he must place this disc on a needle so that there is no smaller disc below it. Of course, the main goal is to calculate the k that minimize the number of transfers (even thought it is not know for sure that this is always the optimal number of movements).
The input file contains several lines of input. Each line contains a single integer N , which is the number of disks to be transferred. Here 0 ≤ N ≤ 10000. Input is terminated by end of file.
For each line of input produce one line of output which indicates the number of movements required to transfer the N disks to the final needle.