#include <bits/stdc++.h>
using namespace std;
int main() {
  int n[4], sum = 0;
  for (int i = 0; i < 4; i++) cin >> n[i];
  string s;
  cin >> s;
  int r[s.size()];
  stringstream ss[s.size()];
  for (int i = 0; i < s.size(); i++) {
    ss[i] << s[i];
    ss[i] >> r[i];
  }
  for (int i = 0; i < s.size(); i++) sum += n[r[i] - 1];
  cout << sum;
  return 0;
}
