#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[4];
  for (int i = 0; i < 4; i++) cin >> arr[i];
  string strips;
  cin >> strips;
  int n = strips.length();
  int cal = 0;
  for (int i = 0; i < n; i++) {
    if (strips[i] == '1')
      cal += arr[0];
    else if (strips[i] == '2')
      cal += arr[1];
    else if (strips[i] == '3')
      cal += arr[2];
    else if (strips[i] == '4')
      cal += arr[3];
  }
  cout << cal;
  return 0;
}
