After you have defeated the Chocolate Gym, Gym Leader Joseph has given you a magical Toblerone bar.
This Toblerone bar is very special. Your Toblerone bar start with a certain length. If the length is odd, the Toblerone bar will grow to 3*(current length)+1 in the next minute. If the length is even, the Toblerone bar will shrink by half in the next minute.
The toblerone keeps repeating this pattern until the Toblerone bar is of length 1. Afterwhich, the Toblerone bar will simply cease to exist. For example, if the length of the Toblerone bar at time = 1 is 5, the sequence is:
5 16 8 4 2 1
At time = 1, the length is 5; At time = 2, the length is 16; At time = 3, the length is 8 and so on. After time = 6, the Toblerone bar will cease to exist.
Your task is simple: given the initial length of the Toblerone bar, find the length of the Toblerone bar at that certain time. If the Toblerone bar does not exist by that time, output -1.