#include <bits/stdc++.h>
using namespace std;
int main() {
  multiset<int> v;
  int ans = 0, n, x[1000], t = 0, u = 0, i;
  cin >> x[0] >> x[1] >> x[2] >> x[3];
  string s;
  cin >> s;
  for (string::iterator it = s.begin(); it != s.end(); it++)
    ans += x[*it - '1'];
  cout << ans;
  return 0;
}
