Many people know Walrus for a lot of things, for grinding math tests to singing Twice lyrics in his room. Speaking of Twice, he decided one day to plant a field of wallflowers in honor of the group. The field consists of an $$$n$$$ by $$$n$$$ grid. With so many flowers, Walrus needs to make sure he has the proper energy for watering them every day in the evening. The energy to water the entire grid is defined below.
After each day, help Walrus figure out how much energy he needs to use up!
The first line will contain $$$n$$$ and $$$d$$$ ($$$2 \le n \le 100$$$ and $$$1 \le d \le 1000$$$): the size of the grid, and the number of days.
The next $$$n$$$ lines will contain binary strings of length $$$n$$$, where each character $$$s_i \in \{0, 1\}$$$ either means the cell is dirt ($$$0$$$) or has flowers ($$$1$$$).
The next $$$d$$$ lines will contain a query in the following format:
For each of the $$$d$$$ queries, print out the amount of energy required. An absolute or relative error of at most $$$10^{-6}$$$ will be permitted.
3 41011000011 2 02 0 0 0 12 0 2 2 21 0 1
5.00000000 4.00000000 3.00000000 4.58578644
4 510111001001010111 0 02 0 0 0 11 1 12 1 1 2 22 3 3 3 1
9.00000000 8.00000000 9.00000000 8.58578644 8.26794919
The below steps describe the first sample.
On the first day, Karp plants flowers at $$$(3, 1)$$$. The energy of the three buddings are $$$3$$$, $$$1$$$, and $$$1$$$.
On the second day, Karp connects $$$(1, 1)$$$ with $$$(1, 2)$$$. The energy of the three buddings are $$$3 - \sqrt{1}$$$, $$$1$$$, and $$$1$$$.
On the third day, Karp connects $$$(1, 3)$$$ with $$$(3, 3)$$$. The energy of the two buddings are $$$3 - \sqrt{1}$$$ and $$$2 - \sqrt{1}$$$.
On the fourth day, Karp plants flowers at $$$(1, 2$$$). The energy of the only budding is $$$6 - \sqrt{2}$$$.
| Name |
|---|


