AT_abc475_f [ABC475F] Rectangle Filling
Description
There is a grid with $ H $ rows and $ W $ columns. Let the cell at the $ i $ -th row from the top and $ j $ -th column from the left be denoted as cell $ (i, j) $ .
Each cell of the grid is painted white or black: cell $ (i, j) $ is white if the $ j $ -th character of $ S_i $ is `.`, and black if it is `#`.
You can perform the following operation **at most once**.
- Choose a rectangular region, and paint all cells within that region black. More formally, choose integers $ h_1, h_2, w_1, w_2 $ satisfying $ 1 \leq h_1 \leq h_2 \leq H $ and $ 1 \leq w_1 \leq w_2 \leq W $ , and paint cell $ (h, w) $ black for every pair of integers $ (h, w) $ satisfying $ h_1 \leq h \leq h_2 $ and $ w_1 \leq w \leq w_2 $ .
Find the number of possible states of the grid that can be obtained. Here, two states of the grid are considered different if there exists a pair of integers $ (i, j) $ satisfying $ 1 \leq i \leq H $ and $ 1 \leq j \leq W $ such that cell $ (i, j) $ is painted white in one state and painted black in the other state.
Input Format
The input is given from Standard Input in the following format:
> $ H $ $ W $ $ S_1 $ $ S_2 $ $ \vdots $ $ S_H $
Output Format
Output the answer.
Explanation/Hint
### Sample Explanation 1
The possible states of the grid obtainable by performing the operation at most once are the following seven:
```
#.. ##. #.# ### #.. ##. ###
.## .## .## .## ### ### ###
```
### Constraints
- $ 1 \leq H, W $
- $ H \times W \leq 2 \times 10^5 $
- $ H $ and $ W $ are integers.
- $ S_i $ is a string of length $ W $ consisting of `.` and `#`.