# #6237. 「AGC003 F」Fraction of Fractal 分形之分数

#### 题目描述

Snuke 从他的母亲那里得到了生日礼物——一个网格。网格有 列。每个单元格都是黑色或白色。所有黑色单元格都是四联通的，也就是说，只做水平或垂直移动且只经过黑色单元格即可从任何黑色单元格移动到任何其他黑色单元格。

#### 样例输入 1

3 3 3
.#.
###
#.#


#### 样例输出 1

20


#### 样例解释 1

.............#.............
............###............
............#.#............
..........#..#..#..........
.........#########.........
.........#.##.##.#.........
..........#.....#..........
.........###...###.........
.........#.#...#.#.........
....#........#........#....
...###......###......###...
...#.#......#.#......#.#...
.#..#..#..#..#..#..#..#..#.
###########################
#.##.##.##.##.##.##.##.##.#
.#.....#..#.....#..#.....#.
###...######...######...###
#.#...#.##.#...#.##.#...#.#
....#.................#....
...###...............###...
...#.#...............#.#...
.#..#..#...........#..#..#.
#########.........#########
#.##.##.#.........#.##.##.#
.#.....#...........#.....#.
###...###.........###...###
#.#...#.#.........#.#...#.#


#### 样例输入 2

3 3 3
###
#.#
###


#### 样例输出 2

1


#### 样例输入 3

11 15 1000000000000000000
.....#.........
....###........
....####.......
...######......
...#######.....
..##.###.##....
..##########...
.###.....####..
.####...######.
###############
#.##..##..##..#


#### 样例输出 3

301811921


#### 数据范围与提示

• 每个 #.
• 网格中所有黑色单元格四联通
• 网格中至少有一个黑色单元格