#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, a2, a3, a4;
  string s;
  int fq[256] = {0};
  cin >> a1 >> a2 >> a3 >> a4;
  cin >> s;
  int l = s.size();
  for (int i = 0; i < l; i++) {
    fq[s[i]]++;
  }
  cout << (fq[49] * a1) + (fq[50] * a2) + (fq[51] * a3) + (fq[52] * a4) << endl;
  return 0;
}
