0.68 George R.R. Martin is a masterful writer, but he writes very slowly. The TV series Game of Thrones initially followed his books, but during the last season the TV script writers couldn’t follow George’s story, because he still hadn’t finished writing it! This resulted in a universally disappointing season, which has angered many fans.
0.32
The TV series took its downturn in an unrealistic battle between the army of the undead (also called white walkers) and the army of living humans. George has decided to fix it, by writing the story in the best possible way: using math.
Suppose that the army of the undead has white walkers and the army of the living has humans. Repeatedly, pick a creature at random and let it kill one of its enemies. Therefore, a walker is killed with probability , and a human is killed otherwise. If a walker dies, nothing else happens. If a human dies, however, it turns into a walker!
The battle ends when one of the armies loses all its warriors. Note that, for large numbers, when humans clearly have a very small chance of victory, whereas when their chances are very high.
Help George figure out who should win the battle and how to keep it optimally interesting. In particular, given the number of walkers , can you determine the minimum number of humans so that the army of the living has at least a 50% chance of victory?
Input consists of several cases, each with a between 1 and .
For every , print the minimum number of humans so that an army of humans will have at least a probability of winning a battle against white walkers. You are allowed to miss your answer by 1 unit. A special corrector will handle it.
Input
1 2 10 10 10
Output
1 3 16 15 17