#include <bits/stdc++.h>
using namespace std;
int main() {
  int n1, n2, n3, n4;
  long long ans;
  unordered_map<char, int> m;
  string s;
  while (cin >> n1 >> n2 >> n3 >> n4) {
    ans = 0;
    m['1'] = n1;
    m['2'] = n2;
    m['3'] = n3;
    m['4'] = n4;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      ans += m[s[i]];
    }
    cout << ans << endl;
  }
  return 0;
}
