#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  vector<int> a(5);
  string s;
  long long q = 0;
  for (int i = 1; i < 5; ++i) {
    cin >> a[i];
  }
  cin >> s;
  for (int i = 0; i < (int)s.size(); ++i) {
    q += a[s[i] - '0'];
  }
  cout << q;
  return 0;
}
