{"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\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":"\u003cp\u003eThere is a grid, consisting of $$$2$$$ rows and $$$n$$$ columns. Each cell of the grid is either free or blocked.\u003c/p\u003e\u003cp\u003eA free cell $$$y$$$ is reachable from a free cell $$$x$$$ if at least one of these conditions holds: \u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$x$$$ and $$$y$$$ share a side; \u003c/li\u003e\u003cli\u003e there exists a free cell $$$z$$$ such that $$$z$$$ is reachable from $$$x$$$ and $$$y$$$ is reachable from $$$z$$$. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eA connected region is a set of free cells of the grid such that all cells in it are reachable from one another, but adding any other free cell to the set violates this rule.\u003c/p\u003e\u003cp\u003eFor example, consider the following layout, where white cells are free, and dark grey cells are blocked:\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/35b42e4e3c64eee3071df3d7b48861e8?v\u003d1726218694\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e \u003cp\u003eThere are $$$3$$$ regions in it, denoted with red, green and blue color respectively:\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/b2528153b76de41b1afcd49c1578a191?v\u003d1726218694\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e \u003cp\u003eThe given grid contains at most $$$1$$$ connected region. Your task is to calculate the number of free cells meeting the following constraint:\u003c/p\u003e\u003cul\u003e \u003cli\u003e if this cell is blocked, the number of connected regions becomes exactly $$$3$$$. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$)\u0026nbsp;— the number of test cases.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$)\u0026nbsp;— the number of columns.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next two lines contains a description of the $$$i$$$-th row of the grid\u0026nbsp;— the string $$$s_i$$$, consisting of $$$n$$$ characters. Each character is either \u003cspan class\u003d\"tex-font-style-tt\"\u003e.\u003c/span\u003e (denoting a free cell) or \u003cspan class\u003d\"tex-font-style-tt\"\u003ex\u003c/span\u003e (denoting a blocked cell). \u003c/p\u003e\u003cp\u003eAdditional constraint on the input: \u003c/p\u003e\u003cul\u003e \u003cli\u003e the given grid contains at most $$$1$$$ connected region; \u003c/li\u003e\u003cli\u003e the sum of $$$n$$$ over all test cases doesn\u0027t exceed $$$2 \\cdot 10^5$$$. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a single integer\u0026nbsp;— the number of cells such that the number of connected regions becomes $$$3$$$ if this cell is blocked.\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\u003e4\n8\n.......x\n.x.xx...\n2\n..\n..\n3\nxxx\nxxx\n9\n..x.x.x.x\nx.......x\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n0\n0\n2\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, if the cell $$$(1, 3)$$$ is blocked, the number of connected regions becomes $$$3$$$ (as shown in the picture from the statement).\u003c/p\u003e"}}]}