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