#include <bits/stdc++.h>
using namespace std;
int main() {
  long long cal[5];
  long long sum = 0;
  cin >> cal[1] >> cal[2] >> cal[3] >> cal[4];
  string s;
  cin >> s;
  for (int(i) = 0; (i) <= s.length() - 1; (i) += 1) sum += cal[s[i] - 48];
  cout << sum << endl;
  ;
  return 0;
}
