#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[4];
  for (int i = 0; i < 4; ++i) {
    cin >> a[i];
  }
  string s;
  cin >> s;
  unsigned long long sum = 0;
  for (string::const_iterator p = s.begin(); p != s.end(); ++p) {
    sum += a[*p - '1'];
  }
  cout << sum << endl;
  return 0;
}
