{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYour company was appointed to lay new asphalt on the highway of length $$$n$$$. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing.\u003c/p\u003e\u003cp\u003eSkipping the repair is necessary because of the climate. The climate in your region is periodical: there are $$$g$$$ days when the weather is good and if you lay new asphalt these days it becomes high-quality pavement; after that, the weather during the next $$$b$$$ days is bad, and if you lay new asphalt these days it becomes low-quality pavement; again $$$g$$$ good days, $$$b$$$ bad days and so on.\u003c/p\u003e\u003cp\u003eYou can be sure that you start repairing at the start of a good season, in other words, days $$$1, 2, \\dots, g$$$ are good.\u003c/p\u003e\u003cp\u003eYou don\u0027t really care about the quality of the highway, you just want to make sure that \u003cspan class\u003d\"tex-font-style-bf\"\u003eat least half of the highway\u003c/span\u003e will have high-quality pavement. For example, if the $$$n \u003d 5$$$ then at least $$$3$$$ units of the highway should have high quality; if $$$n \u003d 4$$$ then at least $$$2$$$ units should have high quality.\u003c/p\u003e\u003cp\u003eWhat is the minimum number of days is needed to finish the repair of \u003cspan class\u003d\"tex-font-style-bf\"\u003ethe whole highway\u003c/span\u003e?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$T$$$ ($$$1 \\le T \\le 10^4$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eNext $$$T$$$ lines contain test cases — one per line. Each line contains three integers $$$n$$$, $$$g$$$ and $$$b$$$ ($$$1 \\le n, g, b \\le 10^9$$$) — the length of the highway and the number of good and bad days respectively.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint $$$T$$$ integers — one per test case. For each test case, print the minimum number of days required to repair \u003cspan class\u003d\"tex-font-style-bf\"\u003ethe whole highway if at least half of it should have high quality\u003c/span\u003e.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n5 1 1\n8 10 10\n1000000 1 1000000\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n8\n499999500000\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case, you can just lay new asphalt each day, since days $$$1, 3, 5$$$ are good.\u003c/p\u003e\u003cp\u003eIn the second test case, you can also lay new asphalt each day, since days $$$1$$$-$$$8$$$ are good.\u003c/p\u003e"}}]}