logo AlgoBeat OnlineJudge
登录 注册

#212854. [NERC 2022] Dominoes

内存限制:1024 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Dora likes to play with dominoes. She takes table, marks some cells as occupied, and then tries to fill all unoccupied cells with dominoes.

Her little brother Dani loves to play pranks on his older sister. So when she is away, he marks two more unoccupied cells as occupied. He wants to do it in such a way that it will be impossible to fill all unoccupied cells with dominoes.

Help Dani to count the number of ways he can select these two cells. Since Dani can only count to one million, if this number of ways is , output .

输入格式

The first line contains integers and (). Next lines contain characters each --- the initial state of the table. Character corresponds to an occupied cell, and character corresponds to an unoccupied cell. It is guaranteed that there are at least two unoccupied cells, and that it is possible to fill all unoccupied cells with dominoes.

输出格式

Let be the number of ways Dani can mark two cells in such a way that it will be impossible to fill all unoccupied cells with dominoes.

Print one integer .

样例

样例输入 1

3 6
...#..
......
#...##

样例输出 1

52

样例输入 2

2 2
..
..

样例输出 2

2

样例输入 3

2 2
#.
#.

样例输出 3

0