{"trustable":true,"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 class\u003d\"panel_content\"\u003eThere are $n$ lights aligned in a row. These lights are numbered $1$ to $n$ from left to right. Initially some of the lights are turned on. Chiaki would like to turn off all the lights.\u003cbr\u003eChiaki starts from the $p$-th light. Each time she can go left or right (i.e. if Chiaki is at $x$, then she can go to $x-1$ or $x+1$) and then press the switch of the light in that position (i.e. if the light is turned on before, it will be turned off and vise versa).\u003cbr\u003eFor each $p\u003d1,2,\\dots,n$, Chiaki would like to know the minimum steps needed to turn off all the lights.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases. The first line of input is an integer $T$ indicates the number of test cases. For each test case:\u003cbr\u003eThe first line contains an integer $n$ ($2 \\le n \\le 10^6$) -- the number of lights.\u003cbr\u003eThe second line contains a binary string $s$ where $s_i\u003d1$ means the $i$-th light is turned on and $s_i\u003d0$ means $i$-th light is turned off.\u003cbr\u003eIt is guaranteed that the sum of all $n$ does not exceed $10^7$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test cases, output $(\\sum\\limits_{i\u003d1}^{|s|} i \\times z_i) \\bmod (10^9+7)$, where $z_i$ is the number of step needed when Chikai starts at the $i$-th light."}},{"title":"Sample","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\r\n3\r\n000\r\n3\r\n111\r\n8\r\n01010101\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n26\r\n432\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}