public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int R = Integer . parseInt ( sc . next ( ) ) ;
  int C = Integer . parseInt ( sc . next ( ) ) ;
  int K = Integer . parseInt ( sc . next ( ) ) ;
  String s [ ] = new String [ R ] ;
  String color [ ] [ ] = new String [ R ] [ C ] ;
  for ( int i = 0 ;
  i < R ;
  i ++ ) {
    s [ i ] = sc . next ( ) ;
    for ( int j = 0 ;
    j < C ;
    j ++ ) {
      color [ i ] [ j ] = s [ i ] . substring ( j , j + 1 ) ;
    }
  }
  for ( int i = 0 ;
  i < R ;
  i ++ ) {
    for ( int j = 0 ;
    j < C ;
    j ++ ) {
      if ( i < K - 1 || i > R - K || j < K - 1 || j > C - K ) {
        if ( color [ i ] [ j ] . equals ( "o" ) ) {
          color [ i ] [ j ] = "*" ;
        }
      }
      if ( color [ i ] [ j ] . equals ( "x" ) ) {
        for ( int y = i - ( K - 1 ) ;
        y <= i + ( K - 1 ) ;
        y ++ ) {
          if ( y < 0 || y >= R ) continue ;
          int width = ( K - 1 ) - Math . abs ( y - i ) ;
          for ( int x = j - width ;
          x <= j + width ;
          x ++ ) {
            if ( x < 0 || x >= C ) continue ;
            if ( color [ y ] [ x ] . equals ( "o" ) ) {
              color [ y ] [ x ] = "*" ;
            }
          }
        }
      }
    }
  }
  int ans = 0 ;
  for ( int i = 0 ;
  i < R ;
  i ++ ) {
    for ( int j = 0 ;
    j < C ;
    j ++ ) {
      if ( color [ i ] [ j ] . equals ( "o" ) ) ans ++ ;
    }
  }
  System . out . println ( ans ) ;
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int R = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; int K = Integer . parseInt ( sc . next ( ) ) ; String s [ ] = new String [ R ] ; String color [ ] [ ] = new String [ R ] [ C ] ; for ( int i = 0 ; i < R ; i ++ ) { s [ i ] = sc . next ( ) ; for ( int j = 0 ; j < C ; j ++ ) { color [ i ] [ j ] = s [ i ] . substring ( j , j + 1 ) ; } } for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( i < K - 1 || i > R - K || j < K - 1 || j > C - K ) { if ( color [ i ] [ j ] . equals ( " o " ) ) { color [ i ] [ j ] = " * " ; } } if ( color [ i ] [ j ] . equals ( " x " ) ) { for ( int y = i - ( K - 1 ) ; y <= i + ( K - 1 ) ; y ++ ) { if ( y < 0 || y >= R ) continue ; int width = ( K - 1 ) - Math . abs ( y - i ) ; for ( int x = j - width ; x <= j + width ; x ++ ) { if ( x < 0 || x >= C ) continue ; if ( color [ y ] [ x ] . equals ( " o " ) ) { color [ y ] [ x ] = " * " ; } } } } } } int ans = 0 ; for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( color [ i ] [ j ] . equals ( " o " ) ) ans ++ ; } } System . out . println ( ans ) ; }
(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 (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 (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (type_identifier) 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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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: (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 (identifier) (binary_expression left: (identifier) right: (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 (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (string_literal))))))) (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (continue_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (continue_statement)) (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (string_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 (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 (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (expression_statement (update_expression (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))