#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[4];
  cin >> arr[0] >> arr[1] >> arr[2] >> arr[3];
  string x;
  cin >> x;
  char *p = &x[0];
  long long int s = 0;
  while (*p != NULL) {
    s += arr[*p - '0' - 1];
    p++;
  }
  cout << s << endl;
  return 0;
}
