#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

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.

## Input

The input will consist of two integers, the starting Toblerone length and the time in which you want to find what length the Toblerone has become. Both integers are at most 10 000.## Output

The length of the Toblerone at that time.## Sample Input

7 5

## Sample Output

17

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 100 | 5 | 1s | 32MB | Average |

2 | 0 | 1 | 1s | 32MB | Average |

### Judge Compile Command

g++-7 ans.cpp -o 3n+1II -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512