{"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\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":"MD","content":"给你四个整数n,c0,c1和h,和一个长度为n的二进制字符串s。\n二进制字符串是由字符0和1组成的字符串。\n您可以更改字符串S的任何字符(字符串在更改之后应该仍然是二进制的)。你每换一次钱就要付h币。\n在一些更改(可能为零)之后,您需要购买字符串。要买字符串,你应该买它所有的字符。购买字符0你应该支付c0硬币,购买字符1你应该支付c1硬币。\n找出购买该字符串所需的最小硬币数量。"}},{"title":"Input","value":{"format":"MD","content":"第一行包含单个整数t(1≤t≤10)——测试用例的数量;\n每个测试用例描述的第一行包含四个整数n,c0,c1,h(1≤n,c0,c1,h≤1000)。\n每个测试用例描述的第二行包含长度为n的二进制字符串s。"}},{"title":"Output","value":{"format":"MD","content":"对于每个测试样例输出购买该字符串所需的最小硬币数量。"}},{"title":"Example","value":{"format":"MD","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\u003e6\n3 1 1 1\n100\n5 10 100 1\n01010\n5 10 1 1\n11111\n5 1 10 1\n11111\n12 2 1 10\n101110110101\n2 100 1 10\n00\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\u003e3\n52\n5\n10\n16\n22\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"MD","content":"在第一个测试用例中,您可以购买所有字符并支付3个硬币,因为字符0和1都需要1个硬币。\n在第二个测试用例中,您可以首先将字符串的第2个和第4个符号从1更改为0,然后为此支付2个硬币。你的线是00000。在那之后,你可以买这根绳子,然后付5⋅10\u003d50硬币。支付的硬币总数为2+50\u003d52。"}}]}