#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int sum = 0;
  int a, b, c, d, l;
  cin >> a >> b >> c >> d;
  string s;
  cin >> s;
  l = s.size();
  for (int i = 0; i < l; i++) {
    if (s[i] == '1') {
      sum += a;
    }
    if (s[i] == '2') {
      sum += b;
    }
    if (s[i] == '3') {
      sum += c;
    }
    if (s[i] == '4') {
      sum += d;
    }
  }
  cout << sum << endl;
  return 0;
}
