public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int c1 = 0 , c2 = 0 , c3 = 0 , c4 = 0 ;
  int a1 = sc . nextInt ( ) ;
  int a2 = sc . nextInt ( ) ;
  int a3 = sc . nextInt ( ) ;
  int a4 = sc . nextInt ( ) ;
  String s = sc . next ( ) ;
  for ( int i = 0 ;
  i < s . length ( ) ;
  i ++ ) {
    if ( s . charAt ( i ) == '1' ) c1 += a1 ;
    else if ( s . charAt ( i ) == '2' ) c2 += a2 ;
    else if ( s . charAt ( i ) == '3' ) c3 += a3 ;
    else c4 += a4 ;
  }
  System . out . println ( c1 + c2 + c3 + c4 ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c1 = 0 , c2 = 0 , c3 = 0 , c4 = 0 ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int a4 = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) c1 += a1 ; else if ( s . charAt ( i ) == '2' ) c2 += a2 ; else if ( s . charAt ( i ) == '3' ) c3 += a3 ; else c4 += a4 ; } System . out . println ( c1 + c2 + c3 + c4 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) 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: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (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: (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: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (identifier)))))))