{"raw_statement":[{"iden":"problem statement","content":"You are given a grid with $N$ rows and $N$ columns, where the square at the $i$\\-th row from the top and $j$\\-th column from the left is painted black if $S_{i, j}$ is `#` and white if $S_{i, j}$ is `.`.  \nYou will choose $K$ of the white squares and paint them red. How many such ways to paint the grid satisfy the following condition?\n\n*   The squares painted red will be connected. That is, you will be able to get from any red square to any red square by repeatedly moving horizontally or vertically while only visiting red squares."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 8$\n*   $1 \\leq K \\leq 8$\n*   Each $S_{i, j}$ is `#` or `.`.\n*   $N$ and $K$ are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$K$\n$S_{1, 1}S_{1, 2} \\dots S_{1, N}$\n$S_{2, 1}S_{2, 2} \\dots S_{2, N}$\n$\\vdots$\n$S_{N, 1}S_{N, 2} \\dots S_{N, N}$"},{"iden":"sample input 1","content":"3\n5\n#.#\n...\n..#"},{"iden":"sample output 1","content":"5\n\nWe have five ways to satisfy the condition as shown below, where `@` stands for a red square.\n\n#.# #@# #@# #@# #@#\n@@@ .@@ @@. @@@ @@@\n@@# @@# @@# .@# @.#\n\nNote that the way shown below does not satisfy the connectivity requirement since we do not consider diagonal adjacency.\n\n#@#\n@.@\n@@#"},{"iden":"sample input 2","content":"2\n2\n#.\n.#"},{"iden":"sample output 2","content":"0\n\nThere is no way to satisfy the condition."},{"iden":"sample input 3","content":"8\n8\n........\n........\n........\n........\n........\n........\n........\n........"},{"iden":"sample output 3","content":"64678"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}