public static void process ( ) throws IOException {
  int n = ni ( ) ;
  int m = ni ( ) ;
  int x = ni ( ) ;
  int y = ni ( ) ;
  char a [ ] [ ] = new char [ n ] [ m ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    String s [ ] = nln ( ) . trim ( ) . split ( "" ) ;
    for ( int j = 0 ;
    j < m ;
    j ++ ) {
      a [ i ] [ j ] = s [ j ] . charAt ( 0 ) ;
    }
  }
  long cost = 0l ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    int j = 0 ;
    while ( j < m ) {
      if ( a [ i ] [ j ] == '.' ) {
        if ( ( 2 * x ) > y ) {
          if ( j + 1 < m ) {
            if ( a [ i ] [ j + 1 ] == '.' ) {
              cost += y ;
              j += 2 ;
            }
            else {
              cost += x ;
              j ++ ;
            }
          }
          else {
            cost += x ;
            j ++ ;
          }
        }
        else {
          cost += x ;
          j ++ ;
        }
      }
      else {
        j ++ ;
      }
    }
  }
  pn ( cost ) ;
}

public static void process ( ) throws IOException { int n = ni ( ) ; int m = ni ( ) ; int x = ni ( ) ; int y = ni ( ) ; char a [ ] [ ] = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s [ ] = nln ( ) . trim ( ) . split ( " " ) ; for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = s [ j ] . charAt ( 0 ) ; } } long cost = 0l ; for ( int i = 0 ; i < n ; i ++ ) { int j = 0 ; while ( j < m ) { if ( a [ i ] [ j ] == ' . ' ) { if ( ( 2 * x ) > y ) { if ( j + 1 < m ) { if ( a [ i ] [ j + 1 ] == ' . ' ) { cost += y ; j += 2 ; } else { cost += x ; j ++ ; } } else { cost += x ; j ++ ; } } else { cost += x ; j ++ ; } } else { j ++ ; } } } pn ( cost ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) (throws (type_identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (method_invocation object: (method_invocation object: (method_invocation name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier)))))) alternative: (block (expression_statement (update_expression (identifier))))))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))))