{"raw_statement":[{"iden":"problem statement","content":"We have a directed graph with $N$ vertices numbered $1$ to $N$. $N$ strings of length $N$ each, $S_1,S_2,\\ldots,S_N$, represent the edges in the graph. Specifically, $S_{i,j}$ is `1` if there is an edge from Vertex $i$ to Vertex $j$, and `0` otherwise. The graph has no self-loops and no multi-edges.\nUntil the graph becomes empty, AtCobear will repeat the following operation:\n\n*   Choose one (unerased) vertex uniformly at random (independently from the previous choices). Then, erase that vertex and all vertices that are reachable from the chosen vertex by traversing some edges. Erasing a vertex will also erase the edges incident to it.\n\nFind the expected value of the number of times the operation is done."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 100$\n*   $S_i$ is a string of length $N$ consisting of `0` and `1`.\n*   $S_{i,i}=$`0`"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$S_1$\n$S_2$\n$\\vdots$\n$S_N$"},{"iden":"sample input 1","content":"3\n010\n001\n010"},{"iden":"sample output 1","content":"1.66666666666666666667\n\nWe have the following three scenarios happening with equal probability:\n\n*   Choose Vertex $1$ in the first operation, erasing Vertex $1$, $2$, and $3$. The graph is now empty, so we are done.\n    \n*   Choose Vertex $2$ in the first operation, erasing Vertex $2$ and $3$. Then, choose Vertex $1$ in the second operation, erasing Vertex $1$. The graph is now empty, so we are done.\n    \n*   Choose Vertex $3$ in the first operation, erasing Vertex $2$ and $3$. Then, choose Vertex $1$ in the second operation, erasing Vertex $1$. The graph is now empty, so we are done.\n    \n\nThus, the expected value of the number of times the operation is done is $(1+2+2)/3=5/3$."},{"iden":"sample input 2","content":"3\n000\n000\n000"},{"iden":"sample output 2","content":"3.00000000000000000000\n\nThere will always be three operations."},{"iden":"sample input 3","content":"3\n011\n101\n110"},{"iden":"sample output 3","content":"1.00000000000000000000\n\nThere will always be one operation."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}