public static void main ( String args [ ] ) {
  Scanner s = new Scanner ( System . in ) ;
  int r = s . nextInt ( ) ;
  int c = s . nextInt ( ) ;
  int total = r * c ;
  boolean [ ] row = new boolean [ r ] ;
  boolean [ ] col = new boolean [ c ] ;
  s . nextLine ( ) ;
  int monsC = 0 ;
  int monsR = 0 ;
  int k = 0 ;
  while ( k < r ) {
    String p = s . nextLine ( ) ;
    for ( int i = 0 ;
    i < p . length ( ) ;
    i ++ ) {
      if ( p . charAt ( i ) == 'S' ) {
        if ( ! row [ k ] ) {
          monsR ++ ;
          row [ k ] = true ;
        }
        if ( ! col [ i ] ) {
          monsC ++ ;
          col [ i ] = true ;
        }
      }
    }
    k ++ ;
  }
  if ( monsC * monsR >= total ) {
    System . out . println ( 0 ) ;
  }
  else {
    System . out . println ( total - monsC * monsR ) ;
  }
}

public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int c = s . nextInt ( ) ; int total = r * c ; boolean [ ] row = new boolean [ r ] ; boolean [ ] col = new boolean [ c ] ; s . nextLine ( ) ; int monsC = 0 ; int monsR = 0 ; int k = 0 ; while ( k < r ) { String p = s . nextLine ( ) ; for ( int i = 0 ; i < p . length ( ) ; i ++ ) { if ( p . charAt ( i ) == ' S ' ) { if ( ! row [ k ] ) { monsR ++ ; row [ k ] = true ; } if ( ! col [ i ] ) { monsC ++ ; col [ i ] = true ; } } } k ++ ; } if ( monsC * monsR >= total ) { System . out . println ( 0 ) ; } else { System . out . println ( total - monsC * monsR ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (block (if_statement condition: (parenthesized_expression (unary_expression operand: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))))) (if_statement condition: (parenthesized_expression (unary_expression operand: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))))))))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))))))))