{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\n \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 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\u0027ll 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\u0027ll assume the worm makes it out.\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; 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 \u0026lt; u and n \u0026lt; 100. A value of n \u003d 0 indicates end of output.\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n 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.\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e\n 10 2 1\n \u003cbr /\u003e 20 3 1\n \u003cbr /\u003e 0 0 0\u0026nbsp;\n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e\n 17\n \u003cbr /\u003e 19\n \u003c/div\u003e \n\u003c/div\u003e"}}]}