{"trustable":false,"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\u0027text/css\u0027\u003e .input, .output {border: 1px solid #888888;} .output {margin-bottom:1em;position:relative;top:-1px;} .output pre,.input pre {background-color:#EFEFEF;line-height:1.25em;margin:0;padding:0.25em;} .title {background-color:#FFFFFF;border-bottom: 1px solid #888888;font-family:arial;font-weight:bold;padding:0.25em;} \u003c/style\u003e \u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027]], displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027]]}\n });\n \u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\" async\n src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\n \u003c/script\u003e\n\u003cp\u003e\nNakul is a cook, and today he has been asked to cook soup. To cook the soup, Nakul needs to purchase ‘\u003cstrong\u003en\u003c/strong\u003e’ litres of tomato purée.\n\u003c/p\u003e\n\u003cp\u003e\nThere are two types of tomato purée bottles available at the store, one bottle is of size \u003cstrong\u003e1 litres\u003c/strong\u003e and the other one is of size \u003cstrong\u003e2 litres\u003c/strong\u003e. Assume that there are infinitely many bottles of these two types in the shop.\n\u003c/p\u003e\n\u003cp\u003e\nThe bottle of size 1 litre. costs ‘\u003cstrong\u003ea\u003c/strong\u003e’ dollar and the bottle of size 2 litre. costs ‘\u003cstrong\u003eb\u003c/strong\u003e’ dollar.\n\u003c/p\u003e\n\u003cp\u003e\nNakul wants to spend as little money as possible to reduce the cost of making the soup.\nYour task is to find the minimum amount of money (in dollars) Nakul needs to buy exactly ‘\u003cstrong\u003en\u003c/strong\u003e’ litres of tomato purée from the nearby shop.\n\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\nThe first line of the input contains one integer \u003cstrong\u003et (\u003ci\u003e1 ≤ t ≤ 500\u003c/i\u003e)\u003c/strong\u003e — the number of test cases.\n\u003c/p\u003e\n\u003cp\u003e\nThe next \u003cstrong\u003et\u003c/strong\u003e lines contain different cases. \n\u003c/p\u003e\n\u003cp\u003e\nThe \u003cstrong\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/strong\u003e case is given as three space-separated integers \u003cstrong\u003en\u003csub\u003ei\u003c/sub\u003e\u003c/strong\u003e , \u003cstrong\u003ea\u003csub\u003ei\u003c/sub\u003e\u003c/strong\u003e and \u003cstrong\u003eb\u003csub\u003ei\u003c/sub\u003e (\u003ci\u003e1 ≤ n\u003csub\u003ei\u003c/sub\u003e ≤ 10\u003csup\u003e12\u003c/sup\u003e\u003c/i\u003e ) (\u003ci\u003e1 ≤ a\u003csub\u003ei\u003c/sub\u003e , b\u003csub\u003ei\u003c/sub\u003e ≤ 1000\u003c/i\u003e)\u003c/strong\u003e — how many liters of tomato purée Nakul needs in the \u003cstrong\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/strong\u003e case, the cost (in dollars) of the bottle of the first type in the \u003cstrong\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/strong\u003e case and the cost (in dollars) of the bottle of the second type in the \u003cstrong\u003ei\u003csup\u003eth\u003c/sup\u003e\u003c/strong\u003e case, respectively.\n\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\nFor each test case print the minimum money required by Nakul to cook the soup.\n\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e10\n9\n1000\n42000000000000\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Explanation\n \u003c/div\u003e\n \u003cpre\u003e\nIn the second case, Nakul should buy \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e bottles of type \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e dollars and one bottle of type one dollar in order to reduce the expenditure. ( \u003cspan class\u003d\"tex-span\"\u003e3*2 + 1*3 \u003d 9\u003c/span\u003e dollars.)\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}