AT_abc472_g [ABC472G] Cascading Grid

Description

There is a grid with $ H $ rows and $ W $ columns. Each cell has one of the characters `+`, `-`, `#` written on it. Let $ (i,j) $ denote the cell at the $ i $ -th row from the top and the $ j $ -th column from the left. The grid is given by $ H $ length- $ W $ strings $ S_1, S_2 , \dots ,S_H $ : the $ j $ -th character of $ S_i $ is written on $ (i,j) $ . You can perform the following operation zero or more times: - Choose one cell that is not `#`. Change to `#` all cells that are "reachable from the chosen cell only by moving to an adjacent cell in the left, right, or down direction without passing through a cell that is `#`." Here, the chosen cell itself is included among the reachable cells. Find the maximum possible value of the following value in the grid after the operations: the number of `+` cells minus the number of `-` cells.

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 If you choose $ (2,1) $ , all cells in row $ 2 $ change to `#` (note that you cannot move upward). The remaining row $ 1 $ has two cells of `+` and one cell of `-`, so the value is $ 2-1=1 $ , and this is the maximum. ### Sample Explanation 2 If you choose $ (1,1) $ , all cells except $ (3, 2) $ become `#`. Note that the chosen cell $ (1, 1) $ itself is included among the reachable cells, and that you cannot pass through a cell that is `#`. ### Constraints - $ 1 \le H,W \le 30 $ - $ S_i $ is a string of length $ W $ consisting of `+`, `-`, `#`. - $ H $ and $ W $ are integers.