An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm climbs out of the well? We'll always count a portion of a minute as a whole minute and if the worm just reaches the top of the well at the end of its climbing, we'll assume the worm makes it out.
一只一英寸的虫子在n英寸深的井里。它每分钟可以爬u英寸。但是每爬一分钟之后,它需要休息一分钟。休息期间,它滑落d英寸。循环往复。什么时候虫子才能爬出井呢?虫子到达井的顶部时,就算是完成了。
输入:
There will be multiple problem instances. Each line will contain 3 positive integers n, u and d. These give the values mentioned in the paragraph above. Furthermore, you may assume d < u and n < 100. A value of n = 0 indicates end of output.
每行输入n,u,d的值,以输入n=0结束输入。
输出:
Each input instance should generate a single integer on a line, indicating the number of minutes it takes for the worm to climb out of the well.
每行应单独输出整数。整数即虫子爬出水井需要的时间。