You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3 × 4 cake may look as follows:

<image>

The cakeminator is going to eat the cake! Each time he eats, he chooses a row or a column that does not contain any evil strawberries and contains at least one cake cell that has not been eaten before, and eats all the cake cells there. He may decide to eat any number of times.

Please output the maximum number of cake cells that the cakeminator can eat.

Input

The first line contains two integers r and c (2 ≤ r, c ≤ 10), denoting the number of rows and the number of columns of the cake. The next r lines each contains c characters — the j-th character of the i-th line denotes the content of the cell at row i and column j, and is either one of these: 

  * '.' character denotes a cake cell with no evil strawberry; 
  * 'S' character denotes a cake cell with an evil strawberry. 

Output

Output the maximum number of cake cells that the cakeminator can eat.

Examples

Input

3 4
S...
....
..S.


Output

8

Note

For the first example, one possible way to eat the maximum number of cake cells is as follows (perform 3 eats).

<image> <image> <image>


import java.io.*;
import java.util.*;

/**
 *  
 * @author akashvermaofskt
 * Coding is love <3!
 */

public class A330 {
    public static void main(String args[]) {
        try {
            int r,c;
            r=nextInt();
            c=nextInt();
            
            int A[][]=new int[r][c];
            
            for (int i = 0; i < r; i++) {
                String s=next();
                
                for (int j = 0; j < s.length(); j++) {
                    if(s.charAt(j)!='S')A[i][j]=1;
                    else A[i][j]=-1;
                }
                //bw.write(Arrays.toString(A[i])+"\n");
            }
            
            int ans=0;
            for (int i = 0; i < r; i++) {
                int flag=0;
                for (int j = 0; j < c; j++) {
                    if(A[i][j]==-1){
                        flag=1;
                        break;
                    }
                }
                
                if(flag==0){
                    for (int j = 0; j < c; j++) {
                        ans+=A[i][j];
                        A[i][j]=0;
                        
                    }
                }
                
                //bw.write(Arrays.toString(A[i])+"\n");
                //bw.write(ans+"\n");
            }
            
            for (int i = 0; i < c; i++) {
                int flag=0;
                
                for (int j = 0; j < r; j++) {
                    if(A[j][i]==-1){
                        flag=1;
                        break;
                    }
                }
                
                if(flag==0){
                    for (int j = 0; j < r; j++) {
                        ans+=A[j][i];
                        A[j][i]=0;
                        
                    }
                }
                
                
            }
            
            
            bw.write(ans+"\n");
            bw.flush();
            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    //TEMPLATE
    
    //******************************************************************************
    // Fast I/O 
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    static StringTokenizer st = null;
    
    static String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    
    static int nextInt() {
        return Integer.parseInt(next());
    }
    
    static long nextLong() {
        return Long.parseLong(next());
    }

    static double nextDouble() {
        return Double.parseDouble(next());
    }
    //******************************************************************************
    // Useful user datatype
    
    static class Pair{
        public int first;
        public int second;

        public Pair(int first, int second){
            this.first = first;
            this.second = second;
            }
        @Override
        public String toString() {
        return "Pair [first=" + first + ", second=" + second + "]";
        }
    }

    static Comparator csort=new Comparator<Pair>(){
                    public int compare(Pair a, Pair b) {
                        if(a.first < b.first)
                        return -1;
                        else if (a.first > b.first)
                        return 1;
                        else
                        return 0;
                    }
                };
    //******************************************************************************
    //Permutations
    // simply prints all permutation - to see how it works
    private static void printPermutations( Comparable[] c ) {
            System.out.println( Arrays.toString( c ) );
            while ( ( c = nextPermutation( c ) ) != null ) {
                    System.out.println( Arrays.toString( c ) );
            }
    }

    // modifies c to next permutation or returns null if such permutation does not exist
    private static Comparable[] nextPermutation( final Comparable[] c ) {
            // 1. finds the largest k, that c[k] < c[k+1]
            int first = getFirst( c );
            if ( first == -1 ) return null; // no greater permutation
            // 2. find last index toSwap, that c[k] < c[toSwap]
            int toSwap = c.length - 1;
            while ( c[ first ].compareTo( c[ toSwap ] ) >= 0 )
                    --toSwap;
            // 3. swap elements with indexes first and last
            swap( c, first++, toSwap );
            // 4. reverse sequence from k+1 to n (inclusive) 
            toSwap = c.length - 1;
            while ( first < toSwap )
                    swap( c, first++, toSwap-- );
            return c;
    }

    // finds the largest k, that c[k] < c[k+1]
    // if no such k exists (there is not greater permutation), return -1
    private static int getFirst( final Comparable[] c ) {
            for ( int i = c.length - 2; i >= 0; --i )
                    if ( c[ i ].compareTo( c[ i + 1 ] ) < 0 )
                            return i;
            return -1;
    }

    // swaps two elements (with indexes i and j) in array 
    private static void swap( final Comparable[] c, final int i, final int j ) {
            final Comparable tmp = c[ i ];
            c[ i ] = c[ j ];
            c[ j ] = tmp;
    }
    //******************************************************************************
    // DSU
    //Maintain an Array A with N elements and Array size for size of each set, intialize A[i]=i and size[i]=1

    static int root(int A[],int i){
        while(A[i]!=i){
            A[i]=A[A[i]];
            i=A[i];
        }
        return i;
    }

    static boolean find(int A[],int a,int b){
        if(root(A,a)==root(A,b))return true;
        else return false;
    }

    static void union(int A[],int size[],int a,int b){
        int ra=root(A,a);
        int rb=root(A,b);

        if(ra==rb)return;

        if(size[ra]<size[rb]){
            A[ra]=A[rb];
            size[rb]+=size[ra];
        }else{
            A[rb]=A[ra];
            size[ra]+=size[rb];
        }
    }

    //**************************************************************************
    //BinarySearch
    /* binary search for 5:
                v-- lower bound
         1 2 3 4 5 5 5 6 7 9
                      ^-- upper bound
        
            binary search for 8
                        v-- lower bound
       1 2 3 4 5 5 5 6 7 9
                        ^-- upper bound
    */
    //For finding greater than 
    static int upper_bound(int A[],int key){
        int first = 0;
        int last = A.length;
        int mid;

        while (first < last) {
            mid =first+(last - first)/2; 

            if (A[mid] <= key)  
                first = mid + 1; 
            else 
                last = mid;
        }

        return first;
    }
    
    //For finding greater than equal to
    static int lower_bound(int A[],int key){
        int first = 0;
        int last = A.length;
        int mid=0;
        
        while (first < last) {
            mid = first + ((last - first) >> 1); 
            if (A[mid] < key)  
                first = mid + 1; 
            else 
                last = mid;
        }
        
        return first;
    }
    //**************************************************************************
}
