We’re preparing your current view and syncing the latest data.
Cakeminator loves cakes and wants to eat as many pieces as possible. The cake is represented as an r x c rectangular grid, where each cell either contains a strawberry ('S') or is empty ('.'). Cakeminator can eat entire rows or columns if they do not contain any strawberry. Once whole rows and columns without strawberries are eaten, determine the maximum number of pieces Cakeminator can eat.
The first line contains two integers r and c (1 ≤ r, c ≤ 10), the number of rows and columns. Then follow r lines, each containing c characters; each character is either 'S' (strawberry) or '.' (empty cell).
Output a single integer — the maximum number of cake pieces Cakeminator can eat.
1 ≤ r, c ≤ 10
Example 1
Input
3 5 S.... ..... ..S..
Output
12
Explanation
The second row has no strawberries, so all 5 cells can be eaten. The third column also has no strawberries except the cell with a strawberry in row 3, so total pieces eaten are 12 after counting safe rows and columns.