{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Once there was an Emperor named Akbar. He had a son named Jahangir. For an unforgivable reason, the king wanted him to leave the kingdom. Since he loved his son, he decided his son would be banished to a new place. The prince became sad, but he followed his father\u0027s will. On the way, he found that the place was a combination of land and water. Since he didn\u0027t know how to swim, he was only able to move on the land. He didn\u0027t know how many places might be his destination. So, he asked for your help.\n\nFor simplicity, you can consider the place as a rectangular grid consisting of some cells. A cell can be a land or can contain water. Each time the prince can move to a new cell from his current position if they share a side.\n\nNow write a program to find the number of cells (unit land) he could reach including the cell he was initially in."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 500)**, denoting the number of test cases.\n\nEach case starts with a line containing two positive integers **W** and **H**; **W** and **H** are the numbers of cells in the **x** and **y** directions, respectively. **W** and **H** will not be more than 20.\n\nThere will be **H** more lines in the data set, each of which includes **W** characters. Each character represents the status of a cell as follows.\n\n1. `.` - land.\n2. `#` - water.\n3. `@` - initial position of the prince (appears exactly once in a dataset)."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the number of cells he can reach from the initial position (including self)."}},{"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\u003e4\n6 9\n....#.\n.....#\n......\n......\n......\n......\n......\n#@...#\n.#..#.\n11 9\n.#.........\n.#.#######.\n.#.#.....#.\n.#.#.###.#.\n.#.#..@#.#.\n.#.#####.#.\n.#.......#.\n.#########.\n...........\n11 6\n..#..#..#..\n..#..#..#..\n..#..#..###\n..#..#..#@.\n..#..#..#..\n..#..#..#..\n7 7\n..#.#..\n..#.#..\n###.###\n...@...\n###.###\n..#.#..\n..#.#..\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 45\nCase 2: 59\nCase 3: 6\nCase 4: 13\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}